-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGrocery List.py
More file actions
46 lines (40 loc) · 1.3 KB
/
Grocery List.py
File metadata and controls
46 lines (40 loc) · 1.3 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
#Grocery List
import datetime
time = datetime.datetime.now() #current date time
month = str(time.month)
day = str(time.day)
hour = str(time.hour)
mint = str(time.minute)
print("Welcome to the Grocery List App.")
print(f"Current Date and Time: {month}/{day}\t {hour}:{mint}")
print("You currently have Meat and Cheese in your list.")
print()
grocery = ['Meat', 'Cheese']
for i in range(3):
food = input("Type of the food to add to the grocery list: ")
grocery.append(food.capitalize())
print("Here is your grocery list:")
print(grocery)
grocery.sort()
print()
print("Here is your sorted grocery list :")
print(grocery)
print()
print("Simulating grocery shopping....")
print()
for i in range(len(grocery)):
print(f"Current grocery list contain {len(grocery)} items : ")
print(grocery)
f1 = input("What food you did buy: ")
grocery.remove(f1.capitalize())
print(f"Removing {f1.capitalize()} from list...")
print()
if(i == 2):
no_item = grocery.pop()
print(f"Sorry, the store is out of {no_item}")
add_new = input("What food would you like instead : ")
grocery.append(add_new.capitalize())
print()
print("Here is what remaining on your grocery list list:")
print(grocery)
break