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)
- Long Pizza
- Online School
- Pismo
- Did you solve the Firefly problem from the Chapter 9 exercises? If you did, here’s something for you: there’s a way to solve it even faster than with the techniques of Chapter 9. You may already have a solution based on the Chapter 9 material that passes all test cases in time. But if you’re compelled to make it faster just because, I encourage you to give it a try.
- Lonely Photo
- Hungry Cow
- 3D Printing
Multiple Chapters
- Year of the Cow
- Semafori (Nice use of some Chapter 4 material with a little of Chapter 5.)
- Moving Day (Keep track of the houses that are free; this will help you determine who to move next.)
- Ekipa