+ 1
ballpark orders
food_cost = [] order = input('Order please: ').split() print(f'your order: {order}') for i in order: if 'Pizza' in i: food_cost.append(6.00) elif 'Nachos' in i: food_cost.append(6.00) elif 'Cheeseburger' in i: food_cost.append(10.00) elif 'Water' in i: food_cost.append(4.00) elif 'Coke' in i: food_cost.append(5.00) else: food_cost.append(5.00) food_cost = sum(food_cost) #efore_tax = str(food_cost) #print(f'before tax: {before_tax}') tax = food_cost / 100 * 7 int_tax = float(tax) print(f'tax is: {tax}') print(f'total cost: {food_cost + tax}' My code is printing out the correct output as displayed in the expected output but the test cases are not approving
23 Antworten
+ 1
#Try this instead
menu = {"Pizza": 6.0, "Nachos": 6.0, "Cheeseburger": 10.0, "Water": 4.0}
orders = input().split()
cost = 0.0
for order in orders:
cost += menu.get(order, 5.0)
print(round(cost * 1.07, 2))
0
Test cases expect output only the result. Don't add, any extra or less character as compare to expected output.
0
Ok
0
I passed 1 - 4 test cases but the 5th test case is locked so I cannot really tell what the problem is
0
Use
Tax = food_cost * 7/100
Not food_cost*100/7
0
I see
0
Can you post the task description along with update code, share code link..
0
Test case 5 is still not approved
0
Ok
0
Update this to exactly code that you using in challenge..
This code not pass any case..
0
Ok
0
Done
0
I think this will also not pass any..
Use only
print(food_cost + tax)
And try to take original input values by don't converting to lowercase...
0
Ok
0
Try now
0
Guess it works...What is the result in code coach?
0
Let me recheck
0
No test case 5 doe not work
0
Does*