Skip to content

Commit 11b225d

Browse files
Merge pull request #540 from strikkerJalaj-25/main
Create ToDoList.py
2 parents c1fc189 + 2ab9ce3 commit 11b225d

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

Python/projects/ToDoList.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Simple To-Do List Manager (20-30 LOC)
2+
3+
tasks = []
4+
5+
def show_menu():
6+
print("\n1. Add Task\n2. View Tasks\n3. Remove Task\n4. Exit")
7+
8+
while True:
9+
show_menu()
10+
choice = input("Choose: ")
11+
12+
if choice == "1":
13+
task = input("Enter task: ")
14+
tasks.append(task)
15+
print("Task added!")
16+
17+
elif choice == "2":
18+
if not tasks:
19+
print("No tasks yet.")
20+
else:
21+
for i, t in enumerate(tasks, 1):
22+
print(f"{i}. {t}")
23+
24+
elif choice == "3":
25+
num = int(input("Task number to remove: "))
26+
if 1 <= num <= len(tasks):
27+
tasks.pop(num - 1)
28+
print("Task removed!")
29+
else:
30+
print("Invalid number.")
31+
32+
elif choice == "4":
33+
print("Goodbye!")
34+
break
35+
36+
else:
37+
print("Invalid choice, try again.")

0 commit comments

Comments
 (0)