nimm
- 📅 2025-08-16T19:12:16.948Z
- 👁️ 20 katselukertaa
- 🔓 Julkinen
# Simple To-Do List Manager
# No extra modules required
def show_menu():
print("\n--- To-Do List ---")
print("1. View tasks")
print("2. Add task")
print("3. Remove task")
print("4. Exit")
tasks = []
while True:
show_menu()
choice = input("Enter your choice (1-4): ")
if choice == "1":
if not tasks:
print("No tasks yet!")
else:
print("\nYour tasks:")
for i, task in enumerate(tasks, start=1):
print(f"{i}. {task}")
elif choice == "2":
task = input("Enter a new task: ")
tasks.append(task)
print(f"Task '{task}' added.")
elif choice == "3":
if not tasks:
print("No tasks to remove.")
else:
try:
num = int(input("Enter task number to remove: "))
removed = tasks.pop(num - 1)
print(f"Task '{removed}' removed.")
except (ValueError, IndexError):
print("Invalid task number!")
elif choice == "4":
print("Goodbye!")
break
else:
print("Invalid choice. Please enter 1-4.")