Question
(I want to know how to output only the valid toppings at the end of the code, currently my code outputs all the user inputs.
(I want to know how to output only the valid toppings at the end of the code, currently my code outputs all the user inputs. I only want it to output the given/available toppings.)
print("Type any of the following and hit enter: ")
print("pepperoni, mushrooms, onions, peppers, olives, bacon, sausage, pineapple, extra cheese")
print("Type 'done' to stop")
print("")
incorrect = 0
alltoppings = ""
total = 0
while True:
toppings = input("")
toppings = toppings.lower()
total = total + 1
total = int(total)
if (toppings != "pepperoni") and (toppings != "mushrooms") and (toppings != "onions") and (toppings != "peppers") and (toppings != "olives") and (toppings != "bacon") and (toppings != "sausage") and (toppings != "pineapple") and (toppings != "extra cheese") and (toppings != "done"):
incorrect = incorrect + 1
print(f"Sorry, {toppings} is not availible topping at Pippers pizza")
if toppings == "done":
incorrect = incorrect +1
break
alltoppings += toppings+" "
total = total - incorrect
print("")
print(f"Toppings: {alltoppings}")
print("Type any of the following and hit enter: "5 print("pepperoni, mushrooms, onions, peppers, olives, bacon, sausage, pineapple, print("Type 'done' to stop") print("") incorrect = 0 alltoppings = "" total = 0 while True: toppings = input("") toppings = toppings. lower() total = total + 1 total = int(total) if (toppings != "pepperoni") and (toppings != "mushrooms") and (toppings != incorrect = incorrect + 1 print(f"Sorry, {toppings} is not availible topping at Pippers pizza") if toppings == "done": incorrect = incorrect +1 break alltoppings += toppings+" " total = total - incorrect print("") print(f"Toppings: {alltoppings}")Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started