Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jun 29, 2024. It is now read-only.

Commit 1ce2c1f

Browse files
Add files via upload
1 parent cf81dbe commit 1ce2c1f

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

‎todolists.py‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import json
2+
import os
3+
4+
def display_menu():
5+
print("Todo List Menu:")
6+
print("1. Add task")
7+
print("2. Remove task")
8+
print("3. View tasks")
9+
print("4. Exit")
10+
11+
def main():
12+
tasks = []
13+
14+
while True:
15+
display_menu()
16+
choice = input("Enter your choice: ")
17+
18+
if choice == "1":
19+
task = input("Enter a new task: ")
20+
tasks.append(task)
21+
print("Task added.")
22+
23+
elif choice == "2":
24+
task = input("Enter the task to remove: ")
25+
26+
if task in tasks:
27+
tasks.remove(task)
28+
print("Task removed.")
29+
else:
30+
print("Task not found.")
31+
32+
elif choice == "3":
33+
print("Tasks:")
34+
for task in tasks:
35+
print("- " + task)
36+
37+
elif choice == "4":
38+
break
39+
40+
else:
41+
print("Invalid choice. Please try again.")
42+
43+
if __name__ == "__main__":
44+
main()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /