forked from Nagasathvik/Python-Programming-Internship
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtodolists.py
More file actions
44 lines (34 loc) · 996 Bytes
/
Copy pathtodolists.py
File metadata and controls
44 lines (34 loc) · 996 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
37
38
39
40
41
42
43
44
import json
import os
def display_menu():
print("Todo List Menu:")
print("1. Add task")
print("2. Remove task")
print("3. View tasks")
print("4. Exit")
def main():
tasks = []
while True:
display_menu()
choice = input("Enter your choice: ")
if choice == "1":
task = input("Enter a new task: ")
tasks.append(task)
print("Task added.")
elif choice == "2":
task = input("Enter the task to remove: ")
if task in tasks:
tasks.remove(task)
print("Task removed.")
else:
print("Task not found.")
elif choice == "3":
print("Tasks:")
for task in tasks:
print("- " + task)
elif choice == "4":
break
else:
print("Invalid choice. Please try again.")
if __name__ == "__main__":
main()