Reputation: 191
When I input this:
def tablesUsed():
"Return which multiplication tables to use"
tablesUsed = [int(x) for x in input("Please choose which multiplication tables you wish\nto practice, then type them like this: 2 5 10.\n").split()]
python skips over the function to the next line. What is going on?
Upvotes: 0
Views: 1585
Reputation: 32300
You need to call it.
tablesUsed()
You also might want to actually return the list.
def tablesUsed():
return [int(x) for x in input("Please choose which multiplication tables you wish\nto practice, then type them like this: 2 5 10.\n").split()]
Otherwise you can't access the list you made in the function, making it useless.
Also, if you're using Python 2, input()
evaluates the input as Python code, and you're more than likely going to get an error. Use raw_input()
to return a string. In Python 3 raw_input()
was removed and replaced by input()
Upvotes: 5