-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminiproject04.py
More file actions
69 lines (52 loc) · 1.89 KB
/
Copy pathminiproject04.py
File metadata and controls
69 lines (52 loc) · 1.89 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
#--------------------------------------------------------------------------------------------------------------------
# Miniproject04 : To-Do List App
#--------------------------------------------------------------------------------------------------------------------
tasks = []
print("Miniproject04 - To Do List")
while True:
print("\n--- To-Do List App ---")
print("1. Add Task")
print("2. View Tasks")
print("3. Mark Task as Done")
print("4. Delete Task")
print("5. Exit")
choice = input("Enter choice: ")
if choice == "1":
task = input("Enter new task: ")
tasks.append(task)
print("Task added successfully!")
elif choice == "2":
if tasks:
print("\nYour Tasks:")
for i in range(len(tasks)):
print(i+1,".",tasks[i])
else:
print("No Tasks found")
elif choice == "3":
if tasks:
for i in range(len(tasks)):
print(i+1,".",tasks[i][0],"-",tasks[i][1])
num= int(input("Enter task number completed:"))
if 1<=num<=len(tasks):
tasks[num-1][1]="DONE"
print("Tasks marked as done.")
else:
print("Invalid task number")
else:
print("No tasks to mark.")
elif choice == "4":
if not tasks:
print("No tasks to delete.")
else:
num = int(input("Enter task number to delete: "))
if 1 <= num <= len(tasks):
tasks.pop(num-1)
print("Task deleted.")
else:
print("Invalid task number.")
elif choice == "5":
print("Exiting program...")
break
else:
print("Invalid choice. Try again.")
print("---------------------------------------------------------------------------------------------")