I need help with a ball park order exercise I feel like I'm close but can't quite get it | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

I need help with a ball park order exercise I feel like I'm close but can't quite get it

order = {"Water": 4.00, "Coke": 5.00, "Pizza": 6.00, "Nachos": 6.00, "Cheeseburger": 10.00} item = input() result = order.get(item, 0) def taxes(price): tax_rate = 0.07 tax_price = price + (price * tax_rate) return tax_price taxed_order = taxes(result) print(taxed_order)

2nd Nov 2023, 2:18 AM
Marshall Lance Freeman
Marshall Lance Freeman - avatar
2 ответов
+ 5
Input contains 4 items. First split input and find total items price. Then call taxes function to get total bill.
2nd Nov 2023, 3:45 AM
Jayakrishna 🇮🇳
+ 3
If I remember correctly the input is a space separated string. Your code will always return 0 when using the dictionary's get method, because item is not equal to the key.
2nd Nov 2023, 3:17 AM
Wong Hei Ming
Wong Hei Ming - avatar