-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtaskManager
More file actions
69 lines (58 loc) · 2.18 KB
/
taskManager
File metadata and controls
69 lines (58 loc) · 2.18 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#Defining tasks
taskList = {
'Art (To Do)': ['Get Paint', 'Buy Canvas'],
'Programming (To Do)': ['Charge Computer', 'Finish Programming Lesson'],
'School (To Do)': ['Read Chapter 1 of Textbook', 'Submit assignment'],
'Art (Completed)': ['Wash Paint Brushes'],
'Programming (Completed)': ['Debug software issues'],
'School (Completed)': ['Study for Finals']
}
#Verify before adding task
def addTask(task_name, category):
if category not in taskList:
print("That's not one of the categories, silly. Please retry.")
return
taskList[category].append(task_name)
print("Task added successfully.")
def markCompleted(task_name, category):
if category not in taskList:
print("That's not one of the categories, silly. Please retry.")
return
if not category.endswith('(To Do)'):
print("This category is already marked as completed.")
return
if task_name not in taskList[category]:
print("Task does not exist. Please retry.")
return
taskList[category].remove(task_name)
completed_category = category.replace('(To Do)', '(Completed)')
taskList[completed_category].append(task_name)
print("Task marked as completed successfully.")
def printToDoList():
for category, tasks in taskList.items():
print(category)
for task in tasks:
print('- ' + task)
print()
while True:
print("What would you like to do?")
print("1. Print Task List")
print("2. Mark Task as Completed")
print("3. Add New Task")
print("4. Exit")
choice = input("Enter the number of your choice: ")
if choice == '1':
printToDoList()
elif choice == '2':
task_name = input("Enter the name of the task to mark as completed: ")
category = input("Enter the category of the task: ")
markCompleted(task_name, category)
elif choice == '3':
task_name = input("Enter the name of the task: ")
category = input("Enter the category for the task: ")
addTask(task_name, category)
elif choice == '4':
print("Exiting the program...")
break
else:
print("Invalid choice. Please enter a valid number.")