9 years & up
Is “Invent With Python” fun and educational?
Our mission at Learn Richly is to find solutions for teaching that are fun and engaging: learning through play. How can a textbook that’s almost 400 pages fit with that mission, you ask? The reality is that a complex skill like Python programming will need more effort and depth than a simple toy can offer. Invent with Python starts by assuming you know nothing about coding. The author holds your hand at every step of the way and speaks to you in a conversational, friendly way. The teaching methods are superb!
The “fun” part comes in when kids get excited about programming, and then playing, their own games. The word games in the title was enough to convince my then-seven-year-old to embark on his Python journey five years ago. Now that the book has been reformatted and overhauled with professional-grade illustrations, it’s an even better choice.
What Will Kids Learn from This Book?
Invent with Python doesn’t resort to partial code snippets or scatter-gun reference topics. Each chapter is organized around the deep, thorough analysis of a single game. After a short introduction to make sure readers can launch the Python shell and code editor, the author immediately dives into writing simple joke and guess-the-number programs. These are all text-based to keep life simple–no graphics or colors or anything that might distract from a working program. Each line of code in the samples is then lovingly, patiently explained. The text is so well written, that, I kid you not, we read the first ≈200 pages of the second edition aloud the first time we used this book. I would quiz my son on what he thought about the lines of code, then we’d get to see the author’s explanations.
Jokes and number-guessing were OK, but my son really got interested when we began writing Dragon Realm, a silly “dungeon” text game that’s introduced a third of the way into the book. I can’t emphasize enough how cheesy and ridiculous this game seemed to me. But for the seven-year-old audience, it was pure magic! He extended and modified that game for hours, making all sorts of silly additions. Sometimes simplicity works because it provides a straight road to mastery for even young coders. No matter how insignificant this Dragon program appeared to my adult eyes, it was the perfect fit for a novice who could understand every part of the program.
Tools and techniques
After this dragon game, the book departs slightly and teaches two simple techniques that are noticeably absent from similar books. First, the author shows us how to use the Python debugger. This is absolutely critical knowledge and helps readers move from “copy and paste” to “write your own code.” Setting break points and watching variables change values are both vital to understanding what’s going on during code execution.
Second, the author began showing us flowcharts of the code’s logical steps. He explained why such preparation before coding is really useful. This feature sounds trivial, but it’s so profound. Young programmers fall into a trap of code-as-you-go and, sadly, often stay there as they become merely “code monkeys.” True software engineers, though, don’t care about languages or even discrete steps at this early stage. They want to understand the user requirements, the inputs, the outputs and the constraints. Once a solid model of the logic and desired output has been created, the overall flow, steps, and language-specific implementation all become much easier. Invent with Python helps you understand how to create programs, not just code them, starting with an ASCII-art implementation of Hangman.
Invent with Python helps you understand how to create programs, not just code them…
After teaching progressively harder text games and introducing a very comprehensive set of Python skills (touching on almost every topic outside of OOP, object-oriented programming), the book reserves the last few chapters for displaying graphics using the Pygame module. In my opinion (feel free to disagree in the comments), this is the correct time to introduce the added complexity of graphics–when students have mastered the Python skills taught via the simple text games.
Successive chapters, the remaining quarter of the book, build upon the simple shapes initially introduced with Pygame. Kids will learn animating graphics, handling keyboard inputs, and adding sounds and sprites/pictures to a game. All this knowledge culminates in a capstone project, an homage to “Space Invaders” that even includes cheat codes.
Alternative Books that Teach the Same Skills
Critics will argue that kids will be bored by all these text-based games in the first two-thirds of the book. If that sounds like your student, check out a book like Teach Your Kids to Code, which starts using graphics (and then graphical games) much earlier. It takes the same explain-everything tack as Invent with Python, but the book feels much newer with color cartoons throughout, color-coded Python syntax, and much earlier use of graphics. We compare both books (and a third title) more thoroughly in Part 4 of this series.
What ages of kids will enjoy “Invent With Python“?
Our DistribuFun histogram for Invent With Python trends just a bit younger than the manufacturer’s recommendation of “9 years & up.” Kids as young as 6 or 7 who are already OK readers will find this book helpful as they explore with their parents. We did the second edition with my 7-year-old and it worked out really well. Frequent visitors to Learn Richly will recognize that we’re big proponents of coding toys that provide a visual introduction to the logic and structures of computer science, so hopefully, even at 6 years old, you’re not starting coding totally fresh. Having quality books like this available makes the “pseudo languages” like Scratch seem unneeded. Moreover, you can immediately apply the Python skills you learn here to a growing array of interesting careers that daily require Python and other data science tools.
A big argument against using this book with youngsters (vs. visual drag and drop languages) is the need for typing skills. I have two potential options for you: either download the game resources and paste the source code into the editor; or, even better, use these programs as raw material for your child’s typing course. The author’s inclusion of a “diff” tool that helps spot mistakes in code makes this course an ideal way to teach typing and coding simultaneously. These projects all presuppose strong reading skills, so do wait until your child reads fluently before tackling these types of assignments.
Finally, we kept the right side of the histogram green for teens and adults, and this book could be a perfectly valid way for older beginners to learn to code. If you’re serious about learning Python as a working adult, however, I’d suggest taking a course or using a book more focused on problems you’ll actually encounter. Python is a phenomenal first teaching language (more why Python is the best teching language in Part Four) and enforces very good habits. More than just a teaching language, however, Python is arguably the best language for data science. Traditional statistics languages like R may be more widely used by statisticians, but Python is growing faster because it’s more versatile and easier to read. Unlike R, it is also an excellent web framework language. In that regard, Python is similar to PHP and Ruby, though not as popular (Django vs. Laravel vs. Rails). Given all these uses for Python, why not start with a book or course of study that assumes nothing while still covering practical topics that grown-ups need?
So, my recommendation for adults is to choose a book with better practical utility like Automate the Boring Stuff with Python, by Al Sweigart. This volume starts at the beginning, but it finishes with useful skills in file management, web scraping, working with Excel spreadsheets, even sending emails and automating the mouse and keyboard. For non-programmers, these skills could be a real boon to the typical office worker’s productivity.
Adults who want to learn Python but get more enthusiastic about hardware and electronics might enjoy Programming the Raspberry Pi, Second Edition: Getting Started with Python (Electronics), by Simon Monk. It’s a little dated now because it doesn’t cover the latest Raspberry Pi 3, but the differences from a programming side are minimal: you shouldn’t have any difficulties adapting it to the latest hardware. This title is a unique hybrid book that teaches coding and touches on just a tiny sampling of the plethora of hardware projects available to build with a Raspberry Pi. It helps you program and setup the Pi, including installation, so for the price of this book and an inexpensive all-in-one Raspberry Pi kit, you just need a free HDMI port on your TV and a spare USB keyboard to be a “real” programmer.
Value and Longevity: Is “Invent With Python” a Good Buy?
The MSRP of Invent With Python is $29.95, set by the publisher. Check around at the links below and you’ll usually be able to find it around 25%-30% off that list price, depending on where you buy. Note that the Kindle version will be cheaper, but you may find more formatting errors or other display issues that are typical with textbooks that are converted to Kindle. A plus side is that digital versions should be updated to fix the errata present in every book like this. Also, since there’s no color in this book, don’t be afraid to use it on your old black and white Kindle if you think the screen will be large enough (you’ll be fine).
On the topic of longevity, Invent with Python has aged extremely well over the years. It uses examples that don’t require exotic extensions or specialized knowledge. I bought my second edition in 2012 and could still use it today. This current fourth edition was published in late 2016 and should stay current for several more years. This long life for the example programs is another advantage of using “retro” text-based games!