ease use Python for this question. Make sure the code is formatted properly. Write a function orderPizza that allows the user input to build a pizza. It then prints a thank you message, the cost of the pizza and then returns the Pizza that was built.
Please use Python for this question. Make sure the code is formatted properly.
Write a function orderPizza that allows the user input to build a pizza. It then prints a thank you message, the cost of the pizza and then returns the Pizza that was built.
Output for this question:
>>> orderPizza()==Pizza('M',{'garlic', 'onion', 'mushroom'})
Welcome to Python Pizza!
What size pizza would you like (S,M,L): Type topping to add (or Enter to quit): Type topping to add (or Enter to quit): Type topping to add (or Enter to quit): Type topping to add (or Enter to quit): Thanks for ordering!
Your pizza costs $14.299999999999999
True
>>> orderPizza()==Pizza('L',{'calamari', 'garlic'})
Welcome to Python Pizza!
What size pizza would you like (S,M,L): Type topping to add (or Enter to quit): Type topping to add (or Enter to quit): Type topping to add (or Enter to quit): Thanks for ordering!
Your pizza costs $16.65
True
>>> orderPizza()==Pizza('S',set())
Welcome to Python Pizza!
What size pizza would you like (S,M,L): Type topping to add (or Enter to quit): Thanks for ordering!
Your pizza costs $6.25
True
#stdin back #
put stdin back to original, again, shouldnt cause error
>>> sys.stdin = si # return stdin
Trending now
This is a popular solution!
Step by step
Solved in 2 steps