We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f6667f2 commit bb61907Copy full SHA for bb61907
TodoListCLI.py
@@ -0,0 +1,34 @@
1
+class TodoList:
2
+ def __init__(self):
3
+ self.tasks = []
4
+
5
+ def add_task(self, task):
6
+ self.tasks.append(task)
7
+ print("Task added:", task)
8
9
+ def show_tasks(self):
10
+ print("Tasks:")
11
+ for i, task in enumerate(self.tasks, start=1):
12
+ print(f"{i}. {task}")
13
14
+if __name__ == "__main__":
15
+ todo_list = TodoList()
16
17
+ while True:
18
+ print("\nOptions:")
19
+ print("1. Add Task")
20
+ print("2. Show Tasks")
21
+ print("3. Exit")
22
23
+ choice = input("Select an option: ")
24
25
+ if choice == "1":
26
+ task = input("Enter task: ")
27
+ todo_list.add_task(task)
28
+ elif choice == "2":
29
+ todo_list.show_tasks()
30
+ elif choice == "3":
31
+ print("Exiting...")
32
+ break
33
+ else:
34
+ print("Invalid choice")
0 commit comments