One simple calculator, taken from first design to best practice.

A programming kata in Jupyter notebooks. The benefit comes from the process, not the result: copy the challenge, attempt it yourself, then compare against a fully annotated walkthrough.

The walkthrough

Follow the notebooks in order — each revisits the same calculator with higher standards. Open any notebook directly in Google Colab (no install) or read it in nbviewer.

Supporting modules

The later versions factor code into modules, built in their own notebooks: my_math, user_interface, and utilities.

The ten best practices

The habits the walkthrough applies, version by version:

  1. Use a code repository — small, frequent commits
  2. Follow style guidelines (PEP 8)
  3. Correct broken code immediately — exceptions, validation, testing
  4. Use PyPI instead of reinventing — import it
  5. Use the right data types and structures
  6. Write readable code — meaningful names and comments
  7. Create readable documentation — docstrings
  8. Use virtual environments
  9. Avoid anti-patterns — specific imports, specific exceptions
  10. Follow the Zen of Python — try import this