-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpractice.py
More file actions
166 lines (152 loc) · 5.99 KB
/
Copy pathpractice.py
File metadata and controls
166 lines (152 loc) · 5.99 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
import time
name = True
while name:
first_name = input('Kindly enter your first name: ')
if first_name.isalpha():
last_name = input('Kindly enter your last name: ')
if last_name.isalpha():
first_name = first_name.capitalize() + ' ' + last_name.capitalize()
genderr = True
while genderr:
gender = input('Kindly enter your gender: ')
if gender.lower() == 'male':
print(f'''
Hello Mr. {first_name}, welcome to TOSIANO restaurant!
''')
name = False
genderr = False
elif gender.lower() == 'female':
print(f'''
Hello Madam {first_name}, welcome to TOSIANO restaurant!
''')
name = False
genderr = False
else:
print(f'Invalid gender, kindly enter Male or Female.')
else:
print(f'Invalid name, name can only contain alphabetic characters.')
time.sleep(3)
print(f'''==========MENU============
* Jollof rice - 500 per portion
* Basmati fried rice - 1000 per portion
* Stir fried spaghetti - 800 per portion
* Yam and egg - 2500 per plate
* Asun goat meat - 3000 per portion
* Boiled egg - 500
* Beef - 500
* Peppered chicken - 3500
* Barbecue chicken - 3000
* Peppered turkey - 5000
* Goat meat - 2500
* Fish - 1500
* Plantain - 500 per portion''')
menu = ['Basmati fried rice', 'Jollof rice', 'Stir fried spaghetti', 'Yam and egg', 'Asun goat meat', 'Boiled egg', 'Beef', 'Peppered chicken', 'Barbecue chicken', 'Goat meat', 'Peppered turkey', 'Fish', 'Plantain']
prices = {
'Basmati fried rice': 1000,
'Jollof rice': 500,
'Stir fried spaghetti': 800,
'Yam and egg': 2500,
'Asun goat meat': 3000,
'Boiled egg': 500,
'Beef': 500,
'Peppered chicken': 3500,
'Barbecue chicken': 3000,
'Goat meat': 2500,
'Peppered turkey': 5000,
'Fish': 1500,
'Plantain': 500
}
total_bill = 0
receipt = []
order_1 = True
while order_1:
order = input('What would you like to order?: ')
match = None
for food in menu:
if food.lower() == order.lower():
match = food
break
if match:
portion_num = True
while portion_num:
portion_number = int(input(f'How many portions of {match} do you want?: '))
if portion_number > 1 and portion_number <= 10:
print(f'Alright!, {portion_number} portions of {match}')
total_bill += portion_number * prices[match]
receipt.append({
'item' : match,
'portions' : portion_number,
'price' : prices[match],
'sub_total' : portion_number * prices[match]
})
order_1 = False
portion_num = False
elif portion_number == 1:
print(f'Alright!, {portion_number} portion of {match}')
total_bill += portion_number * prices[match]
receipt.append({
'item' : match,
'portions' : portion_number,
'price' : prices[match],
'sub_total' : portion_number * prices[match]
})
order_1 = False
portion_num = False
else:
print('Sorry, we can\'t sell more than 10 portions per person.')
else:
print('Sorry, we don\'t have that in the menu.')
ans = True
while ans:
second_order = input('Would you like to order anything else?: ')
if second_order.lower() == 'yes':
order_2 = True
while order_2:
orderr_2 = input('What else would you like to order?: ')
match = None
for food in menu:
if food.lower() == orderr_2.lower():
match = food
break
if match:
portion_num_2 = True
while portion_num_2:
portion_numberr_2 = int(input(f'How many portions of {match} do you want?: '))
if portion_numberr_2 > 1 and portion_numberr_2 <= 10:
print(f'Alright!, {portion_numberr_2} portions of {match}')
total_bill += portion_numberr_2 * prices[match]
receipt.append({
'item' : match,
'portions' : portion_numberr_2,
'price' : prices[match],
'sub_total' : portion_numberr_2 * prices[match]
})
order_2 = False
portion_num_2 = False
elif portion_numberr_2 == 1:
print(f'Alright!, {portion_numberr_2} portion of {match}')
total_bill += portion_numberr_2 * prices[match]
receipt.append({
'item' : match,
'portions' : portion_numberr_2,
'price' : prices[match],
'sub_total' : portion_numberr_2 * prices[match]
})
order_2 = False
portion_num_2 = False
else:
print('Sorry, we can\'t sell more than 10 portions per person.')
else:
print('Sorry, we don\'t have that in the menu.')
elif second_order.lower() == 'no':
time.sleep(2)
print('\n========== RECEIPT ==========')
for order in receipt:
print(f"{order['item']} x{order['portions']} @ {order['price']} = {order['sub_total']}")
print('------------------------------')
print(f'TOTAL: {total_bill}')
print('==============================')
print('Thank you for your patronage!')
ans = False
else:
print('Please enter Yes or No.')