Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(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}")image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions

Question

Are these written ground rules?

Answered: 1 week ago

Question

How do members envision the ideal team?

Answered: 1 week ago

Question

Has the team been empowered to prioritize the issues?

Answered: 1 week ago