I’m very new to programming so I’m sure my code isn’t as neat as possible, and I’m certain it isn’t working how I would like it to. Basically, I’m playing around with this code, and I want to make it so that the user could input various synonyms to ‘Yes’ for the code to work properly (I have commented out the various options) but I can’t seem to work out how to do it. Does anyone have any advice?
price = input('How much is a burger? ')
within_budget = float(price) <= 10.00
veggie = input('Is there a vegetarian option?')
is_veggie = veggie == 'Yes' #'Y', 'Definitely', 'yes', 'y', 'sure'
is_good_choice = within_budget and is_veggie
if is_good_choice:
print('This restaurant is a good choice')
if not is_good_choice:
print('The restaurant is not a good choice')
I tried making a list but as I figured out, that then requires you to put in the whole list to return True, not just one string in the list.
It seems like a .lower function might be of some use and I’ve played around with it but I keep getting an error so I must be putting it in the wrong place.
Katie Harris is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.