Question: (def coffee_bot () : name = input ( Can I get your name please? ) welcome_message () get_drink_type () get_size() 16 amount () 8

 (def coffee_bot () : name = input (" \ Can Iget your name please? ") welcome_message () get_drink_type () get_size() 16 amount() 8 print ("\ Thanks, {}! Please proceed to the pick upcounter for your order! ". format (name) ) 9 adef welcome_message ()

(def coffee_bot () : name = input (" \ Can I get your name please? ") welcome_message () get_drink_type () get_size() 16 amount () 8 print ("\ Thanks, {}! Please proceed to the pick up counter for your order! ". format (name) ) 9 adef welcome_message () : print ("Welcome to the plazacafe! \ \ Today's specials are white coffee and black coffee. ") 5 Gdef error_message () : print( "\ I'm sorry, I did not understand your selection. \ \ Please enter the corresponding letter for your response. ") 18 (def get_drink_type () : res = input("\ What type of drink would you like?\ [a] white Coffee \ [b] Black coffee \ > ") res = res . lower () if res == "a": return "White Coffee" elif res = = "b":25 elif res = = "b": A1x1 return "Black coffee" else : error_message () return get_drink_type () def get_size () : res = input(' \ What size drink can I get for you? \ [a] small \ [b] Medium \ [c] Large \ > .) res = res . lower () if res == "a": return "Small" elif res == "b": return "Medium" elif res = = "c": return "Large" else: error_message () return get_size () 45 16 (def amount () : choice = get_drink_type () size = get_size() 49 get_drink_type04. For this question, duplicate your coffee orders program, and rewrite it as a new version with errorchecking. You must submit both questions, so don't change the other code. Your errorchecking should repeat until the user enters valid inputs. Note that this means you no longer assumefchoose the expensive option, because it won't be possibly to choose the colour "purple" or a wrong size. Rewrite your code constructs to take this into consideration effectively if needed. if choice == "Black coffee" and size == "Small": return "You have to pay, $3. to pick your order" elif choice == "Black coffee" and size == "Medium": return "You have to pay, $4. to pick your order" elif choice == "Black coffee" and size == "Large": return "You have to pay, $5. to pick your order" elif choice == "White coffee" and size == "Medium": return "You have to pay, $5. to pick your order" elif choice == "White coffee": return "You have to pay, $1. to pick your order" else: error_message () (def get_quantity () : res = input("\ What is quantity for this order?") try : res = int(res) return res except ValueError: print ("\ Invalid input. Please enter a value quantity. ") return get_quantity ()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!