Counting Pennies

Learning Python Through Mathematical Puzzles

Author
Published

September 19, 2026

Preface

This is a book about learning Python through mathematical puzzles.

Each chapter starts with a small puzzle that a curious 5th- or 6th-grader can state and reason about by hand. The puzzle then becomes the spine of the chapter: we use it to introduce exactly the Python tools needed to solve it, and we let a little mathematical thinking back the code up.

The seed puzzle — the one that gave the book its name:

Using pennies, nickels, dimes, and quarters, in how many ways can we form $1?