-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2-To-do-List.py
More file actions
43 lines (35 loc) · 1.12 KB
/
2-To-do-List.py
File metadata and controls
43 lines (35 loc) · 1.12 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
# Simple To-Do List Application
tasks = []
while True:
print("\n Simple To-Do List ")
print("1. Add Task")
print("2. View Tasks")
print("3. Delete Task")
print("4. Exit")
choice = input("Enter your choice (1-4): ")
if choice == "1":
task = input("Enter the task: ")
tasks.append(task)
print(f"Task added: {task}")
elif choice == "2":
if not tasks:
print("No tasks available!")
else:
print("\nYour Tasks:")
for i, task in enumerate(tasks, 1):
print(f"{i}. {task}")
elif choice == "3":
if not tasks:
print("No tasks to delete!")
else:
task_number = int(input("🗑️ Enter task number to delete: "))
if 1 <= task_number <= len(tasks):
deleted_task = tasks.pop(task_number - 1)
print(f"Task deleted: {deleted_task}")
else:
print("Invalid task number!")
elif choice == "4":
print("Exiting... Goodbye!")
break
else:
print("Invalid choice! Please select a valid option.")