-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsolution16.py
More file actions
30 lines (24 loc) · 634 Bytes
/
solution16.py
File metadata and controls
30 lines (24 loc) · 634 Bytes
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
"""
# ex.16
A fast food chain has these meals
| Meal | Price |
|---------|--------------|
| Burger | 5$ |
| Pizza | 3$ |
| Hot Dog | 1,5$ |
Create a program that:
* Reads the meal the customer wants
* Prints the cost of the meal
* Input example: "Hot Dog"
* Output: "Hot Dog 1,50$"
"""
#Solution using dictionary:
def menu_price(menu_dict, meal_item):
if meal_item in menu_dict.keys():
return meal_item, menu_dict[meal_item]
else:
return("This item is not in the menu")
dict_meals = {"Burger": "5$","Pizza": "3$", "Hot Dog": "1.50$"}
food = "Caterpillar"
cost = menu_price(dict_meals, food)
print(cost)