import random
print("\nRandom Food Generator")
firstName = input("\nwhat is your first name: ")
lastName = input("\nwhat is your last name: ")
print("\nHello, ", firstName, lastName)
hungerStatus = input("are you hungry?: Y/N ")
print(hungerStatus)
if hungerStatus == "y" or hungerStatus == "Y":
print("\n",firstName, lastName,"What would you like to eat? ",)
print('\npizza', '\nfruit salad', '\ntuna', '\ncurrant slice')
foodOptions = input["pizza", "fruit salad", "tuna", "currant slice"]
choiceOfFood = input("")
else:
print("\nYou are not hungry")
if choiceOfFood == foodOptions:
print(choiceOfFood)
Have you looked at that line? Is that what you intended to write with input? What is your intention here, might be worth a view of How to ask good questions (and get good answers)
Yes that is what i intended to write with input. It worked for over a month but now it gets a typeError at line 17
I’m not sure there was any version of Python where that would work. The error is there for a reason, you’re doing something that can’t be done, you cannot use input
like that; it’s intended to be used as a callable, e.g. input()
or input("prompt text")
.
What is foodOptions
supposed to be here, what is your intention?
foodOptions is a list. Thank you, ive found my error, you were correct. i must of added that input without realising at some point
1 Like