if choices q printThank you for ordering break When it detects a correct input

If choices q printthank you for ordering break when

This preview shows page 1 - 2 out of 2 pages.

if choices == "q": print("Thank you for ordering") break #When it detects a correct input it will ask how many times and append the item to the list accordingly elif choices == "egg" or choices == "hash brown" or choices == "toast" or choices == "bacon" or choices == "tea" or choices == "coffee" or choices == "sausage": amount = formatInput(input("How many?")) if amount.isnumeric(): for n in range(int(amount)): cart.append(choices) #When the user does not enter a valid number like "Five", (.isnumeric()) is a function inside of python that is able to tell me whether it is a number or not. else: print("please enter in a numeric number") #For the different sizes of breakfast there is a different method implemented, the items in the lists are added according to the amount they want elif choices == "small breakfast" or choices == "regular breakfast" or choices == "big breakfast" : amount = formatInput(input("How many?")) if amount.isnumeric(): if choices == "small breakfast": for n in range(int(amount)): for w in small_breakfast: cart.append(w) if choices == "regular breakfast": for n in range(int(amount)): for w in regular_breakfast: cart.append(w) if choices == "big breakfast": for n in range(int(amount)): for w in big_breakfast: cart.append(w) else: print("please enter in a numeric number")
Image of page 1

Subscribe to view the full document.

#This invalid input is for when the item entered is not valid and cannot be recognized by the program else: print("invalid input") total_price = 0 #Going through the list and accumulating the price of the meal for n in cart: if n == "egg": total_price += 0.99 elif n == "bacon": total_price += 0.49 elif n == "sausage": total_price += 1.49 elif n == "hash brown": total_price += 1.19 elif n == "toast": total_price += 0.79 elif n == "coffee": total_price += 1.09 elif n == "tea": total_price += 0.89 #Final statement for the order, showing the tax and total price after tax. print("Cost: $", round(total_price, 2)) print("Tax: $", round(total_price * 0.13,2)) print("Total price after tax: $", round(total_price * 1.13,2))
Image of page 2
  • Fall '12
  • Bauer
  • Breakfast foods

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes