So I was trying to create a basic Python application that essentially pretends to ask the user to choose 1 of 3 restaurant types. When given an answer, it asks how far away should the restaurant be: "5-10 minutes." This part is where everything seems to go wrong. When giving an answer for the distance, it completely ignores my elif and my else command, no matter what I do. I don't understand what the problem is. (The else command at the very bottom is for when the number isn't 5-10, I just haven't corrected the quotes yet)
print("I found 3 types of restaurants in your location:")
print("- General Diner")
print("- Italian")
print("- Vegetarian")
categoryChoice = input("Where would you like to go? ")
distance = input("The nearest restaurant is within 5-10 minutes, please choose a distance: ")
float_value1 = distance
string_value1 = int(float_value1)
if(categoryChoice == 'General Diner'):
if (string_value1 == 5 or 6 or 7 or 8 or 9):
print("I found 1 general diner within " + distance + " minutes:")
print("Gourmet Burger Barn")
confirmation = input("Would you like to go here? ")
if(confirmation == 'Yes'):
print("We are now traveling to: Gourmet Burger Barn")
elif (string_value1 == 10):
print("I found 2 general diners within " + distance + " minutes:")
print("- Gourmet Burger Barn")
print("- The Corner Kitchen")
confirmation = input("Which would you like to go to? ")
if(confirmation == 'Gourmet Burger Barn'):
print("We are now traveling to: Gourmet Burger Barn")
elif(confirmation == 'The Corner Kitchen'):
print("We are now traveling to: The Corner Kitchen")
else:
print("There is no restaurant within 1-4 minutes of your location")
Aucun commentaire:
Enregistrer un commentaire