Skip to content

Commit baac511

Browse files
authored
Shopping List Application
1 parent 84b125e commit baac511

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

shopping.py

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
shopping_list = []
2+
3+
4+
def add_item():
5+
item = input("\n Item to add: ")
6+
shopping_list.append(item)
7+
print("\n " + item + " has been added.")
8+
9+
10+
def remove_item():
11+
item = input("\n Item to remove: ")
12+
shopping_list.remove(item)
13+
print("\n " + item + " has been removed.")
14+
15+
16+
def start():
17+
print("\n Welcome to your shopping list.")
18+
print(" Press (1) to view your list.")
19+
print(" Press (2) to add an item.")
20+
print(" Press (3) to remove an item.")
21+
22+
answer = input("\n > ")
23+
24+
if answer == "1":
25+
for x in shopping_list:
26+
print(x)
27+
28+
start()
29+
30+
elif answer == "2":
31+
add_item()
32+
33+
start()
34+
35+
elif answer == "3":
36+
remove_item()
37+
38+
start()
39+
40+
else:
41+
start()
42+
43+
44+
start()

0 commit comments

Comments
 (0)