-
Notifications
You must be signed in to change notification settings - Fork 0
/
day35_100c.py
126 lines (122 loc) · 3.99 KB
/
day35_100c.py
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
import os, time
myAgenda = []
def printList():
for item in myAgenda:
print(item)
print()
def colorChange(color):
if color=="red":
return ("\033[31m")
elif color=="white":
return ("\033[0m")
elif color=="blue":
return ("\033[34m")
elif color=="yellow":
return("\033[033m")
elif color=="green":
return("\033[032m")
elif color=="purple":
return("\033[035m")
text1 = " 📝 ToDo List Manager 📝"
while True:
print(f"{colorChange('yellow')}{text1:>5}")
print(f"{colorChange('white')}")
print("Do you want to view, add, remove ")
menu = input("or edit your to-do list? ")
print()
if menu == "add":
item = input("What's next on the Agenda?: ")
if item in myAgenda:
print("-----------------------------------")
print("That item is already on the agenda.")
print("Please try again.")
print()
print("Restarting...")
time.sleep(3)
os.system('clear')
else:
myAgenda.append(item)
os.system('clear')
elif menu == "view":
os.system('clear')
elif menu == "remove":
print()
item = input("What do you want to remove?: ")
print(f"You want to remove: {item} ")
confirm = input("Are you sure you want to remove this item? (y/n): ")
if confirm == "y":
if item in myAgenda:
myAgenda.remove(item)
os.system('clear')
time.sleep(1)
else:
os.system('clear')
time.sleep(1)
print()
print(f"{item} not found")
print()
elif confirm == "n":
print("You selected 'n'")
print("Restarting")
time.sleep(2)
os.system('clear')
else:
text2 = "Invalid Option"
text3 = "Please type in 'y' or 'n' then press ENTER"
print()
print(f"{colorChange('red')}{text2}")
print(f"{colorChange('red')}{text3}")
time.sleep(2)
os.system('clear')
print(f"{colorChange('white')}")
elif menu == "edit":
print()
item = input("What do you want to edit?: ")
print(f"You want to edit: {colorChange('green')}{item} ")
confirm = input(f"{colorChange('white')}Are you sure you want to edit this item?:{colorChange('green')} (y/n) ")
if confirm == "y":
if item in myAgenda:
newitem = input(f"{colorChange('white')}What should we replace it with?:{colorChange('green')} ")
if newitem in myAgenda:
text4 = "Duplicate entry."
print()
print(f"{colorChange('white')}{text4}")
time.sleep(1)
os.system('clear')
else:
myAgenda.remove(item)
item = newitem
myAgenda.append(newitem)
os.system('clear')
time.sleep(1)
print(f"{colorChange('white')}")
else:
os.system('clear')
time.sleep(1)
print()
print(f"{item} not found")
print()
elif confirm == "n":
print("You selected 'n'")
print("Restarting")
time.sleep(2)
os.system('clear')
else:
text2 = "Invalid Option"
text3 = "Please type in 'y' or 'n' then press ENTER"
print()
print(f"{colorChange('red')}{text2}")
print(f"{colorChange('red')}{text3}")
time.sleep(2)
os.system('clear')
print(f"{colorChange('white')}")
else:
print("Invalid option")
print("Please try again")
time.sleep(2)
os.system('clear')
continue
print(" AGENDA")
print("----------------------------")
printList()
print("----------------------------")