Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

To-do list #320

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

To-do list #320

wants to merge 4 commits into from

Conversation

Evy04
Copy link

@Evy04 Evy04 commented Mar 24, 2023

A simple program in Python that allows the user to manage a simple to-do list. The user can add, remove, and view tasks in the list.

@msathyaanand
Copy link

def display_menu():
print("===== To-Do List Manager =====")
print("1. Add a task")
print("2. Remove a task")
print("3. View tasks")
print("4. Exit")

def add_task(tasks):
task = input("Enter the task: ")
tasks.append(task)
print("Task added successfully!")

def remove_task(tasks):
task = input("Enter the task to remove: ")
if task in tasks:
tasks.remove(task)
print("Task removed successfully!")
else:
print("Task not found!")

def view_tasks(tasks):
if len(tasks) == 0:
print("No tasks found!")
else:
print("===== Tasks =====")
for index, task in enumerate(tasks, start=1):
print(f"{index}. {task}")

def todo_list_manager():
tasks = []
while True:
display_menu()
choice = input("Enter your choice (1-4): ")
if choice == "1":
add_task(tasks)
elif choice == "2":
remove_task(tasks)
elif choice == "3":
view_tasks(tasks)
elif choice == "4":
print("Exiting the program...")
break
else:
print("Invalid choice! Please try again.")

Run the program

todo_list_manager()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants