-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest2.py
More file actions
50 lines (39 loc) · 1.34 KB
/
test2.py
File metadata and controls
50 lines (39 loc) · 1.34 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
def pizzatopping(list):
if len(list)==0:
print("nothing in your topping")
else:
print("The toppings on your pizza are:")
for item in list:
print('\t',item)
print("----Operations----")
print("a\tAdd a topping")
print("r\tRemove topping")
print("o\torder the pizza")
print("s\tQuit")
print("s\tStart over")
toppingList=[]
while True:
print("What do you like to do?")
menu=input('\t'+"add,remove,order,quit,startover:")
if menu.lower()=='a' or menu.lower()=="add":
addtopping=input("Type in a topping to add: ")
toppingList.append(addtopping)
elif menu.lower()=="r" or menu.lower()=="remove":
removetopping=input("Type in topping to remove: ")
if removetopping in toppingList:
index=toppingList.index(removetopping)
toppingList.pop(index)
else:
print("topping not found")
elif menu.lower()=="o" or menu.lower()=="order":
pizzatopping(toppingList)
print("Thanks for order!")
exit()
elif menu.lower()=="s" or menu.lower()=="startover":
toppingList=[]
elif menu.lower()=="q" or menu.lower()=="quit":
break
else:
print("I'm not sure what you said, please try again.")
pizzatopping(toppingList)
print("Thank for order!")