0

Code Challenge Ballpark Orders Python: My code works for all but the hidden examples

I was doing the Ballpark Orders coding challenge and I don't see what's wrong with my code, additionally, since the only examples failing are the hidden ones I don't get the problem menu = {"coke": 5, "nachos": 6, "pizza": 6, "water": 4, "cheeseburger": 10} order = input().lower().split() sub = 0 for item in order: if item in menu: sub += menu[item] else: sub += menu["coke"] price = sub * 1.07 print(price)

30th May 2024, 12:49 PM
Ninjohannes
2 Réponses
+ 4
round the price to 2 decimals
30th May 2024, 1:49 PM
Lisa
Lisa - avatar
+ 2
Lisa Thank you so much, I was going crazy because I was sure that the code was functionally correct
30th May 2024, 3:13 PM
Ninjohannes