-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTo Do List.py
More file actions
36 lines (29 loc) · 798 Bytes
/
To Do List.py
File metadata and controls
36 lines (29 loc) · 798 Bytes
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
tasks = []
def show_menu():
print("\n---- TO-DO LIST ----")
print("1. Add Task")
print("2. View Tasks")
print("3. Remove Task")
print("4. Exit")
while True:
show_menu()
choice = input("Enter choice: ")
if choice == "1":
task = input("Enter new task: ")
tasks.append(task)
print("Task added!")
elif choice == "2":
print("\nYour Tasks:")
for i, t in enumerate(tasks, 1):
print(f"{i}. {t}")
elif choice == "3":
num = int(input("Enter task number to remove: "))
if 1 <= num <= len(tasks):
tasks.pop(num - 1)
print("Task removed!")
else:
print("Invalid number!")
elif choice == "4":
break
else:
print("Invalid choice!")