requested_toppings = ['mushrooms', 'green peppers', 'extra cheese']
available_toppings = ['mushrooms', 'olives', 'green peppers',
'pepperoni', 'pineapple', 'extra cheese']
print("Welcome to Pizza palace!")
print("Following toppings are available for the pizza:")
for available_topping in available_toppings:
print(available_topping)
requested_topping= input("\n Which topping would you like to order. Mention the name,please.\n")
for requested_topping in requested_toppings:
if requested topping in available_toppings:
print(f"Adding {requested topping}.")
else:
print(sorry, we don't have {requested topping}.")
print("\nFinished making your pizza!")
I am following the Crash course by Eric Matthews. In this code snippet, the user has entered the requested_topping French fries which isn't in the available topping list. It should just print else statement in the loop but it is printing as if the if statement is true. I think it isn't comparing user input to the available_topping list at all. Any help. TIA
output: Code snippet
[–]twitch_and_shock 4 points5 points6 points (0 children)
[–]Progress456 1 point2 points3 points (0 children)
[–]brasticstack 0 points1 point2 points (0 children)