Ex48 keep getting this error message

This is my scanner for directions:

def scan(lexicon):

lexicon = input('> ')
if lexicon[0] == 'n':
    print("You want to go north")
elif lexicon[0] == 's':
    print("You want to go south")
elif lexicon[0] == 'e':
    print("You want to go east")
else:
    print("not a valid response")

But I keep getting this :

TypeError: scan() takes 0 positional arguments but 1 was given

Hi @GK77 please post your code for the scan-function, but I bet you don’t have specified any parameters in your function.

I think I looks something like this:

def scan():
    pass

But you call it with an argument def scan(lexicon). So python doesn’t now what to do with it.

You should write your scan function something like this:

def scan(input):
    input = xxx
1 Like