Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python ordering food coding Clarification (2/19): You may assume all input will be lowercase-only strings. You may also assume that we will not enter an

python ordering food coding

image text in transcribed

Clarification (2/19): You may assume all input will be lowercase-only strings. You may also assume that we will not enter an item that contains both burger and soda.

You've just been hired to work at a popular restaurant in the center of town. Your manager, trying to keep up with the internet age, would like to design a new app so that customers can order on the go. Since you're quite proficient in Python, you eagerly accept the job Write a Python program that repeatedly prompts the user to enter a food item until a null string is entered. You should store each item entered in a Python list, then print out the items, one at a time, ignoring duplicates (the customer clearly mistyped). Finally, print out the total cost of the food items entered, as follows If the food's name contains 'burger', it costs $3.00 If the food's name contains 'soda', it costs $2.00 All other foods are premium items and cost $5.00 You may want to use the Python in operator to check each entered string for 'burger' or 'soda'. An example interaction with the new app is given below: Welcome to the Python Buffet, the hippest restaurant in town! What would you like to order? cheeseburger Would you like to order anything else? cream soda Would you like to order anything else? cheeseburger Oops. You must have entered cheeseburger again by accident Would you like to order anything else? pineapple Would you like to order anything else? You have ordered the following: cheeseburger cream soda pineapple This will cost you a total of $10.00 Thank you for your patronage! Constraints/Comments You must store the entered food items in a Python list You must remove (or not add in the first place) duplicate items from the list manually (you cannot typecast it as a set, for example) You must return the total cost of the items in proper dollar and cents format (HINT: Use the format function!) Remember, duplicate items do not contribute to the total cost of the order; your customers only want to pay once for each unique item! You are not allowed to import any modules for this

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

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

Students also viewed these Databases questions

Question

Write formal proposal requests.

Answered: 1 week ago

Question

Write an effective news release.

Answered: 1 week ago

Question

Identify the different types of proposals.

Answered: 1 week ago