-
Notifications
You must be signed in to change notification settings - Fork 0
/
day51_100c.py
127 lines (122 loc) · 4.06 KB
/
day51_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
# OpenAI GPT3 Assisted Code
import os, time
lifeOrg = []
def prettyPrint():
print()
for row in lifeOrg:
for item in row:
print(f"{item:^10}", end=" | ")
print()
print()
while True:
with open("lifeOrg.txt", "r") as f:
lifeOrg = [line.strip().split(" ") for line in f.readlines()]
os.system("clear")
print("\t\t🌟Life Organizer🌟")
print()
print("\tTODO List Management System")
print("\tVIEW")
print()
time.sleep(0.3)
print("1: Add")
time.sleep(0.3)
print("2: View")
time.sleep(0.3)
print("3: Remove")
time.sleep(0.3)
print("4: Edit")
time.sleep(0.3)
print("5: Save")
time.sleep(0.3)
print("6: Quit")
time.sleep(0.3)
print()
menu = input("> ")
if (menu.strip().lower()[0] == "a" or menu.strip().lower()[0] == "1"):
print()
print("ADD A TASK")
print()
task = input("What is the task? ")
due = input("When is it due? ")
prio = input("What is its priority? (HIGH/MED/LOW) ")
row = [task, due, prio]
lifeOrg.append(row)
with open("lifeOrg.txt", "a") as f:
f.write(" ".join(row) + "\n")
elif (menu.strip().lower()[0] == "v" or menu.strip().lower()[0] == "2"):
os.system("clear")
print("\t\t🌟Life Organizer🌟")
print()
print("\tTODO List Management System")
print()
time.sleep(0.3)
print("1: View All")
time.sleep(0.3)
print("2: View Priority")
print()
viewCho = input("> ")
if (viewCho.strip().lower()[0] == "a" or viewCho.strip().lower()[0] == "1"):
os.system("clear")
print("\t\t🌟Life Organizer🌟")
print()
print("\tTODO List Management System")
print()
prettyPrint()
time.sleep(2)
elif (viewCho.strip().lower()[0] == "p" or viewCho.strip().lower()[0] == "2"):
print("Enter the priority level you want to view: ")
print("(HIGH/MEDIUM/LOW)")
priority_level = input("> ").upper()
for row in lifeOrg:
if row[2].upper() == priority_level:
print(row)
time.sleep(2)
elif (menu.strip().lower()[0] == "r" or menu.strip().lower()[0] == "3"):
os.system("clear")
print("\t\t🌟Life Organizer🌟")
print()
print("\tTODO List Management System")
print("\tWhat task do you wish to Remove? ")
print()
prettyPrint()
print()
task = input("> ")
items_to_remove = []
for row in lifeOrg:
if task in row:
items_to_remove.append(row)
for item in items_to_remove:
lifeOrg.remove(item)
with open("lifeOrg.txt", "w") as f:
for row in lifeOrg:
f.write(" ".join(row) + "\n")
elif (menu.strip().lower()[0] == "e" or menu.strip().lower()[0] == "4"):
os.system("clear")
print("\t\t🌟Life Organizer🌟")
print()
print("\tTODO List Management System")
print("\tEdit a task")
print()
prettyPrint()
task = input("Enter the task to edit: ")
new_task = input("Enter the new task: ")
new_due = input("Enter the new due date: ")
new_prio = input("Enter the new priority: ")
tasks = []
for i, row in enumerate(lifeOrg):
if task in row:
lifeOrg[i] = [new_task, new_prio]
with open("lifeOrg.txt", "w") as f:
for row in lifeOrg:
f.write(" ".join(row) + "\n")
elif (menu.strip() == "5"):
with open("lifeOrg.txt", "w") as f:
for row in lifeOrg:
f.write(" ".join(row) + "\n")
elif (menu.strip() == "6"):
save_choice = input("Do you want to save changes? (yes/no)")
if save_choice.lower() == 'yes':
with open("lifeOrg.txt", "w") as f:
for row in lifeOrg:
f.write(" ".join(row) + "\n")
break