Problem Set 13: Simple To-Do List

When you start a new problem set, your first instinct might be to open your computer and begin typing code right away. While this can feel productive, it often leads to frustration when things don't work as expected. Instead, take a few minutes to slow down and plan.

Here are some helpful strategies:

  1. Understand the problem clearly
    • Read the instructions carefully — twice if needed.
    • Ask yourself: What exactly is being asked?
  2. Break the problem into smaller steps
    • Think about the smallest possible actions the computer will need to perform.
    • For example: If the task is to find the first recurring letter in a word, what steps must happen first?
  3. Try solving it on paper first
    • Write out your steps in plain language (pseudocode).
    • Test your steps with a simple example before touching the keyboard.
  4. Translate your steps into code
    • Start small — write only a few lines at a time and test often.
    • Don't worry about perfection at first; get a working version, then improve it.
  5. Check your solution
    • Run it with different examples, including edge cases.
    • Ask: Does this solve the problem in all situations?

  • 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 task
    • 2. Remove task
    • 3. Show tasks
    • 4. Quit
  • Use a loop so the menu keeps showing until the user chooses Quit.

 

Task 5: Test Cases

Run your program with these actions:

  1. Add: "Do homework"
  2. Add: "Wash dishes"
  3. Add: "Read book"
  4. Show → Should display all three tasks.
  5. Remove: "Wash dishes"
  6. Show → Should display remaining two tasks.
  7. 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.