On the third and fourth test for Felipe's Taqueria (CS50P) the output seems correct to me, but apparently is wrong. This is the test's output: Could not find the following in the output: $14.00 Actual Output: $3.00 $6.00 $14.00 Add item:
And this is my code:
price_list = {"Baja Taco": 4.00,"Burrito": 7.50,"Bowl": 8.50,"Nachos": 11.00,"Quesadilla": 8.50,"Super Burrito": 8.50,"Super Quesadilla": 9.50,"Taco": 3.00,"Tortilla Salad": 8.00}
def main():
order = []
while True:
try:
items = input("Add item: \n").title()
order.append(items)
add_up(order)
except EOFError:
break
except KeyError:
pass
def add_up(order):
values = []
for item in order:
price = price_list[item]
values.append(price)
result = float(sum(values))
print("$", f"{result:.2f}",sep='')
main()
Also, if someone could advice about my style or if I could've done something more efficiently it would be appreciated.