0

Can you find mistake in my code?

menu = {"Pizza":6, "Nachos":6, "Cheeseburger":10, "Water":4, "Coke":5} order = input().split() bill = 0 for i in order: if i in menu: bill += menu[i] else: bill += menu["Coke"] print(bill*(1.07))

16th Jan 2022, 2:43 PM
Sonam Tashi
4 Antworten
+ 4
Output should be rounded to 2 decimals. print(round(bill*(1.07),2))
16th Jan 2022, 3:53 PM
Simba
Simba - avatar
+ 1
What's the task? Why do you add "Coke" if I is not in menu?
16th Jan 2022, 2:49 PM
Lisa
Lisa - avatar
+ 1
Lisa here is the task You and three friends go to a baseball game and you offer to go to the concession stand for everyone. They each order one thing, and you do as well. Nachos and Pizza both cost $6.00. A Cheeseburger meal costs $10. Water is $4.00 and Coke is $5.00. Tax is 7%. Task Determine the total cost of ordering four items from the concession stand. If one of your friend’s orders something that isn't on the menu, you will order a Coke for them instead. Input Format You are given a string of the four items that you've been asked to order that are separated by spaces. Output Format You will output a number of the total cost of the food and drinks. Sample Input 'Pizza Cheeseburger Water Popcorn' Sample Output 26.75
16th Jan 2022, 2:50 PM
Sonam Tashi
0
I think it's something about the taxes. Is there any hint if they apply to all items on the menu the same?
16th Jan 2022, 3:16 PM
Lisa
Lisa - avatar