-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTo_do_List
44 lines (35 loc) · 1.29 KB
/
To_do_List
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
def main():
tasks = []
while True:
print("\n===== To-Do List =====")
print("1. Add Task")
print("2. Show Tasks")
print("3. Mark Task as Done")
print("4. Exit")
choice = input("Enter your choice: ")
if choice == '1':
print()
n_tasks = int(input("How may task you want to add: "))
for i in range(n_tasks):
task = input("Enter the task: ")
tasks.append({"task": task, "done": False})
print("Task added!")
elif choice == '2':
print("\nTasks:")
for index, task in enumerate(tasks):
status = "Done" if task["done"] else "Not Done"
print(f"{index + 1}. {task['task']} - {status}")
elif choice == '3':
task_index = int(input("Enter the task number to mark as done: ")) - 1
if 0 <= task_index < len(tasks):
tasks[task_index]["done"] = True
print("Task marked as done!")
else:
print("Invalid task number.")
elif choice == '4':
print("Exiting the To-Do List.")
break
else:
print("Invalid choice. Please try again.")
if __name__ == "__main__":
main()