- Read the question carefully (twice).
- Break the task into the smallest steps.
- Sketch or write pseudocode before coding.
- Start small — test as you go.
- Check your solution with different cases.
Problem Description
A to-do list helps us keep track of tasks we need to complete.
In this problem, you will build a simple text-based to-do list manager that lets a user add and remove tasks.
Learning Goals
By completing this problem, you should be able to:
- Use a list/array to store multiple items.
- Add and remove items from the list.
- Write a simple menu system with user input.
- Loop so the program keeps running until the user decides to quit.
Tasks
Task 1: Add a Task
- Create an empty list called
tasks. - Ask the user to enter a task.
- Add the task to the list.
- Print the list of tasks.
Example:
Enter a task: Buy groceries
Your tasks: ['Buy groceries']
Task 2: Add Multiple Tasks
- Update your program so the user can add more than one task.
- Each new task is added to the list.
- After each addition, print the list.
Example:
Enter a task: Buy groceries
Enter a task: Clean room
Your tasks: ['Buy groceries', 'Clean room']
Task 3: Remove a Task
- Add a feature that lets the user remove a task by typing its name.
- If the task is found, remove it from the list.
- If not found, print
"Task not found."
Example:
Current tasks: ['Buy groceries', 'Clean room']
Enter task to remove: Clean room
Current tasks: ['Buy groceries']
Task 4: Add a Menu
- Create a simple menu system:
1. Add task2. Remove task3. Show tasks4. Quit
- Use a loop so the menu keeps showing until the user chooses
Quit.
Task 5: Test Cases
Run your program with these actions:
- Add: "Do homework"
- Add: "Wash dishes"
- Add: "Read book"
- Show → Should display all three tasks.
- Remove: "Wash dishes"
- Show → Should display remaining two tasks.
- Quit
Extension Challenge (Optional)
- Let the user remove a task by number instead of typing the full name.
- Add an option to mark a task as complete without deleting it.
- Save tasks to a file so they remain after the program ends.
Success Criteria
- You can explain how lists are used to store multiple tasks.
- Your program can add, remove, and display tasks.
- Your program keeps running until the user chooses to quit.
- (Extension) Your program supports task numbers, marking complete, or file saving.