Free lab Real Python 3. Zero installs. Your code stays in this browser. Open the playground

To-Do Manager with File Persistence

A real CRUD app in miniature: add and complete tasks, persist them to disk so nothing is lost on restart, and report progress — the heart of Todoist, Trello and every task app.

Intermediate 4 steps 100 XP ~40 min

How it works in the real world

Every task app is CRUD — Create, Read, Update, Delete — plus persistence:

  1. State — tasks live in memory as a list of dicts (like a mini database table).
  2. Operations — add and complete are functions that modify state.
  3. Persistence — state is serialised to a file and reloaded on startup; without this, a restart wipes everything.
  4. Reporting — aggregate state into stats users care about.

Swap the file for SQLite and the print for HTML and you literally have a web app — that's the whole secret.

Build progress0 / 4 steps
1

Create & read

Implement add_task(title) appending {"id": next_id, "title": title, "done": False} (ids start at 1). Add the three tasks, then print each as 1. [ ] buy milk.

Blank · autosaved
PYstep_1.py
Run your code to check this step…
2

Update: complete a task

Implement complete_task(task_id) that marks the matching task done. Complete task 2, then print the list — task 2 shows [x].

Blank · autosaved
PYstep_2.py
Run your code to check this step…
3

Persistence: save & load

Save each task to todo.txt as id|done|title (done as 0/1), then load the file back into a new list and print the count and the second task's title: 3 walk dog.

Blank · autosaved
PYstep_3.py
Run your code to check this step…
4

The progress report

Print one summary line: 3 tasks: 1 done, 2 pending (33% complete) — percentage rounded to a whole number.

Blank · autosaved
PYstep_4.py
Run your code to check this step…
Your next ten minutes

Write Python that does something useful.

Start free. No install, no card, no passive video marathon.

Start learning free → Explore the path