BugHunt

Python dictionary exercises

Dictionaries are how real Python programs hold data, and they fail in a few very specific ways: a key that is not there, a loop that only sees keys, a dict changed while you walk through it. Each exercise here is one of those, in a short function with tests.

Find the line, fix it, run the tests. Everything runs in your browser.

See the 7 exercisesOr follow the 30-day path

The dictionaries bugs you will meet

The exercises

Errors you might be searching for

More Python practice by topic

Questions

How hard are these?

Mostly medium: dictionaries tend to come after lists and strings in a course. Try the Python list exercises first if these feel steep.

Do they run real Python?

Yes, Python 3 compiled to WebAssembly (Pyodide), in your browser. Nothing is sent to a server.