Dictionary as parameter?!?

Dictionary as parameter?!?
0

Hi coders,
I’m stuck with a HackerRank’s challenge :pensive:
this is text of challenge : https://www.hackerrank.com/challenges/30-dictionaries-and-maps/problem
and this is my code that I developed:

# Enter your code here. Read input from STDIN. Print output to STDOUT

def list_address_book(n, address_book):
    n = int(input())
    address_book = dict()
    user_input = input()
    key , value = user_input.split()
    address_book [key] = value
    for key , value in address_book :
        if key == "":
            print("Not found")
        else:
         print (address_book[key]  [value])

    

if __name__ == "__main__":
    list_address_book(n,address_book)

I know that the call 's function is wrong because give me a error about parameters that I put, but I don’t know how to fix it.
Have you some suggestions?
Thanks,
CamCode

Your function should not have any parameters. That is what’s causing the error I think: when calling the function ‘n’ and ‘address_book’ have not been defined anywhere and since you read these in your function again it makes sense to have no arguments

did you import a module?

Hi,
I tried your suggestion to remove the parameters, but it still gives me error.
This is error:

Traceback (most recent call last):
File "Solution.py", line 19, in <module>
list_address_book()
File "Solution.py", line 10, in list_address_book
for key , value in address_book :
ValueError: too many values to unpack (expected 2)