-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShopping list.py
More file actions
53 lines (36 loc) · 1006 Bytes
/
Shopping list.py
File metadata and controls
53 lines (36 loc) · 1006 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
shopping_list = []
def show_help():
print('What should we pick up at the store?')
print("""
Enter 'DONE' to stop adding items.
Enter 'HELP' for additional info.
Enter 'SHOW' to see your shopping list
Enter 'remove' to remove an item
""")
def add_to_list(item):
shopping_list.append(item)
print('{} was added to your shopping list!'.format(item))
print('You have {} items on your list.'.format(len(items)))
def show_list():
print('My Shopping List:')
for item in shopping_list:
print(item)
def to_remove():
print('Enter the item to be removed')
shopping_list.remove(input())
show_help()
while True:
items=list(input())
if shopping_list == 'DONE':
break
elif shopping_list == 'HELP':
show_help()
continue
elif shopping_list == 'SHOW':
show_list()
continue
elif shopping_list =='remove':
to_remove()
continue
add_to_list(items)
show_list()