Learn to Code by Solving Problems: A Python Programming Primer Homepage for the book Learn to Code by Solving Problems: A Python Programming Primer

Additional Exercises

Want more practice solving problems and programming in Python?

Each chapter in the book already ends with a list of suggested exercises, my favourite coding problems that really target the material that you just learned. To get the most out of the book and hone your coding skill, I suggest putting serious effort into these exercises. (For some exercises in the book, I supply hints. But try to ignore those hints unless you’re really stuck.)

But there’s more! I’m always on the lookout for other irresistibly good problems. And when I find new ones, I’ll include them on this page. Please do share your favourite problems with me as well… I’d appreciate that!

Some problems on this page may use online programming judge websites that we don’t use in the book, so you might need to make some new judge accounts.

I recommend working through the problems in the book before the extra ones on this page.

Have fun!

Chapter 1 (Getting Started)

Chapter 2 (Making Decisions)

Chapter 3 (Repeating Code: Definite Loops)

Chapter 4 (Repeating Code: Indefinite Loops)

Chapter 5 (Organizing Values Using Lists)

Chapter 6 (Designing Programs with Functions)

Chapter 7 (Reading and Writing Files)

Chapter 8 (Organizing Values Using Sets and Dictionaries)

Chapter 9 (Designing Algorithms with Complete Search)

Chapter 10 (Big O and Program Efficiency)

Multiple Chapters