-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtaqueria.py
39 lines (31 loc) · 989 Bytes
/
taqueria.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
menu: dict[str, float]= {
"Baja Taco": 4.25,
"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():
"""
User can order items off the menu one at a time.
Each correctly inputted item is totaled to their 'bill'.
[CTRL + D] {EOFError} to end their order.
"""
bill = 0
while True:
try:
user_order = input("Item: ").title() # Input stored and formatted to match dict
if user_order in menu:
bill += menu[user_order] # Add's value to bill
print(f"Total: ${bill:.2f}") # Displays bill after proper input
except EOFError:
print() # New line for bash
break
except KeyError:
pass
if __name__ == "__main__":
main()