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

Finding a Bug

… It looks like my code has a glitch. I’m not really sure where it is. I check pairs of flavors with good count behavior. Does anyone know what’s the sitch? The problem that we’re trying to solve is Icecream. Make sure you’ve read through Chapter 9 of Learn to Code by Solving Problems. Here’s the code that doesn’t quite work: lst = input().... Read more

Solving Good Groups Using Dictionaries

Hello! We’re going to solve a problem here using Python dictionaries. I’m assuming that you’ve already studied the first eight chapters of Learn to Code by Solving Problems. If you have, you know how powerful Python dictionaries can be. Whenever you need to make an association between two groups of data, a dictionary is likely what you want to ... Read more

My Personal Top Five Foundational Python Books

Hello, readers, To write a good book, one important and time-consuming process is to read many good books. Prior to writing Learn to Code by Solving Problems, I had read dozens of Python programming books. Here are five of the best ones, including a mini review that I wrote for each one. My main criterion here was building a rock-solid Pytho... Read more

Can You Solve This Using Only Chapter 1?

Here’s a problem I recently gave my students. Can you solve it using only Chapter 1 of Learn to Code by Solving Problems? Fix Dan’s Sentences Dan’s writing a new book, but he needs a bit of help with his grammar. Correct the given sentences by adding commas in the correct locations throughout the sentence. Input A single line containing t... Read more

How to Handle the Practice Exercises

(Inspired by Jun tsuru, one of my readers.) Q: help! I’m getting my butt kicked by the practice problems in Learn to Code by Solving Problems. What do I do? A: first, you’re doing the right thing trying the practice problems. Reading alone is not enough. Second, repeat this to yourself three times: it is normal to struggle on practice problem... Read more