CENG113 HOMEWORK#1 CoffeeShop Solved




5/5 - (1 vote)

You are expected to write a Python program for a coffee shop.
In the shop, there are several coffee types which are given to you in Python list named
coffee_listand their corresponding prices are given to you in another Python list named
coffee_list = [“Espresso”, “Cappuccino”, “Americano”, “Macchiato”, “Mocha”, “Filter”, “Turkish”]
price_list = [5.50, 7.75, 7.25, 9.50, 9.25, 5.75, 6]

For each customer, the coffee shop program asks for the coffeetype,coffeecupsizeandthe
numberofcups.(Note: A customer can only ask for one type/size of coffee for each order.)
● Coffeetype:It can be one of the coffee types which is listed in coffee_list.
● Coffeecupsize:It can be “Tall”, “Grande”, and “Venti”. Price of tall size coffees is listed
in price_list. Price of grande size is 1 TL higher than the price of tall size. Price of venti
size is 0.50 TL higher than the price of grande size. (Exception: For Turkish coffee, there
is no grande and venti size.)
● Thenumberofcups:It determines how many cups of coffee are ordered by the
After receiving those three answers, the program calculates the total price of the ordered
● If the calculated total is higher than 20TL, the program makes a 10% discount.
● Every multiple of 10th customer is congratulated and gets a free order. He/she doesn’t
have to pay anything.

Then, the program informs the customer how much the order costs.
At the end of the day, the program calculates the total income and the total number of cups of
coffees sold. (End of the day is signaled by entering “X” as the coffee type.)

Important Notes:

● You should take threeinputs from the customer: coffee type, coffee cup size and the
number of cups.
● Be careful about invalidinputs! Ask each question over and over again until a valid input
is entered.
● Coffee type and cup size should be caseinsensitive.
● You should printthe following statements for customers: “You ordered 5 Grande cups of
Mocha and the price is 41.625 TL”
● You should printthe following statements for the coffee shop at the end of the day: “We
have sold 60 coffees and our total sale is 418.5 TL”.


● Using isdigit() function, the strings given by the users can be checked if they are
composed of only digits:
my_str = “abcd”
my_str.isdigit() => False
my_str = “359”
my_str.isdigit() => True
● Using title() function, the first letters of the strings given by the users can be capitalized:
my_str = “abcd”
my_str = my_str.title() #my_str becomes “Abcd”


1. You should submit your assignments through CMS until due date.
2. Your homework should be named as
3. Use comments in your code, otherwise you will losesome points.
4. Write your studentIDas a comment atthebeginningofyourcode.