-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTo-doList-project.py
More file actions
39 lines (34 loc) · 1.18 KB
/
To-doList-project.py
File metadata and controls
39 lines (34 loc) · 1.18 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
def display_tasks(task_list):
print("To-Do List:")
for index, task in enumerate(task_list):
print(f"{index + 1}. {task}")
def main():
tasks = []
while True:
print("\nMenu:")
print("1. Display tasks")
print("2. Add task")
print("3. Mark task as completed")
print("4. Quit")
choice = input("Enter your choice: ")
if choice == "1":
display_tasks(tasks)
elif choice == "2":
new_task = input("Enter the new task: ")
tasks.append(new_task)
print("Task added!")
elif choice == "3":
display_tasks(tasks)
task_index = int(input("Enter the index of the completed task: ")) - 1
if 0 <= task_index < len(tasks):
completed_task = tasks.pop(task_index)
print(f"Task '{completed_task}' marked as completed!")
else:
print("Invalid index.")
elif choice == "4":
print("Goodbye!\n Created By Qavi Shaikh :)")
break
else:
print("Invalid choice. Please select a valid option.")
if __name__ == "__main__":
main()