This undertaking is a beginner-friendly To-Do List App in Python. It affords a easy command-line interface for challenge management. Users can upload obligations, view them, mark them as finished, and put off them as wished. The software runs in a loop until the consumer chooses to exit.
How to develop TO_DO_LIST_APP in Python
Step 1: Initialize an empty list to store tasks
tasks = []
Step 2: Define a loop to display the menu and take user input
while True:
print("\nTo-Do List App")
print("1. Add Task")
print("2. View Tasks")
print("3. Mark Task as Done")
print("4. Remove Task")
print("5. Exit")
choice = input("Enter your choice: ")
Step 3: Adding a new task
if choice == "1":
task = input("Enter task: ")
tasks.append({"task": task, "done": False})
print("Task added successfully!")
Step 4: Viewing all tasks
elif choice == "2":
if not tasks:
print("No tasks available.")
else:
for index, task in enumerate(tasks, start=1):
status = "[Done]" if task["done"] else "[Not Done]"
print(f"{index}. {task['task']} {status}")
Step 5: Marking a task as done
elif choice == "3":
if not tasks:
print("No tasks to mark as done.")
else:
task_num = int(input("Enter task number to mark as done: "))
if 1 <= task_num <= len(tasks):
tasks[task_num - 1]["done"] = True
print("Task marked as done!")
else:
print("Invalid task number.")
Step 6: Removing a task
elif choice == "4":
if not tasks:
print("No tasks to remove.")
else:
task_num = int(input("Enter task number to remove: "))
if 1 <= task_num <= len(tasks):
removed_task = tasks.pop(task_num - 1)
print(f"Task '{removed_task['task']}' removed successfully!")
else:
print("Invalid task number.")
Step 7: Exiting the program
elif choice == "5":
print("Exiting To-Do List App. Have a great day!")
break
else:
print("Invalid choice, please try again.")
SAMPLE OUTPUT
To-Do List App
1. Add Task
2. View Tasks
3. Mark Task as Done
4. Remove Task
5. Exit
Enter your choice: 1
Enter task: Buy groceries Task added successfully!
To-Do List App
1. Add Task
2. View Tasks
3. Mark Task as Done
4. Remove Task
5. Exit Enter your choice: 1
Enter task: Complete Python project Task added successfully!
To-Do List App
1. Add Task
2. View Tasks
3. Mark Task as Done
4. Remove Task
5. Exit
Enter your choice: 2
1. Buy groceries [Not Done]
2. Complete Python project [Not Done]
To-Do List App
1. Add Task
2. View Tasks
3. Mark Task as Done
4. Remove Task
5. Exit
Enter your choice: 3
Enter task number to mark as done: 1
Task marked as done!
To-Do List App
1. Add Task
2. View Tasks
3. Mark Task as Done
4. Remove Task
5. Exit
Enter your choice: 2
1. Buy groceries [Done]
2. Complete Python project [Not Done]
To-Do List App
1. Add Task
2. View Tasks
3. Mark Task as Done
4. Remove Task
5. Exit
Enter your choice: 4
Enter task number to remove: 2
Task 'Complete Python project' removed successfully!
To-Do List App
1. Add Task
2. View Tasks
3. Mark Task as Done
4. Remove Task
5. Exit
Enter your choice: 5
Exiting To-Do List App. Have a great day!