Project oriented programming books, books that help you develop actual working programs while you learn to program, are the thing, and the new Impractical Python Projects: Playful Programming Activities to Make You Smarter is an excellent example.
Knowing how the elements of a program work is fine and dandy, but applying programming concepts to the real world is where the rubber of code meets the reality of … running code, I guess. Impractical Python Projects: Playful Programming Activities to Make You Smarter is full of code examples, and they are said to be impractical, but really, that depends on why you even use computers. For example, one might want to breed rodents of unusual size, or come up with an anagram suitable for a Dark Wizard. Even more useful is calculating the odds of detecting alien civilizations (I for one welcome our hypothetical overlords from elsewhere in the universe). Make a python programmed volcano for your next science project. Seriously, that’s not a bad idea for the kiddo…
To give you an idea, here are the chapters:
Chapter 1: Silly Name Generator
Chapter 2: Finding Palingram Spells
Chapter 3: Solving Anagrams
Chapter 4: Decoding American Civil War Ciphers
Chapter 5: Encoding English Civil War Ciphers
Chapter 6: Writing in Invisible Ink
Chapter 7: Breeding Giant Rats with Genetic Algorithms
Chapter 8: Counting Syllables for Haiku Poetry
Chapter 9: Writing Haiku with Markov Chain Analysis
Chapter 10: Are We Alone? Exploring the Fermi Paradox
Chapter 11: The Monty Hall Problem
Chapter 12: Securing your Nest Egg
Chapter 13: Simulating an Alien Volcano
Chapter 14: Mapping Mars with the Mars Orbiter
Chapter 15: Improving Your Astrophotography with Planet Stacking
Chapter 16: Finding Frauds with Benford’s Law
This book does something else, that not too many coding instruction books do. The author, Lee Vaughan, builds small projects that work, then applies python based methods to analyze the code, showing how the original project had problems of one kind or another, then builds them again. The results are surprising, even spectacular, and very instructive.
The book does assume a basic knowledge of how python works, but that is not hard to get from any of several other books, or on line. Rather than being an introductory text, Vaughan’s project pushes you in interesting directions for solving a diverse set of problems. Most of these “impractical” projects, while themselves being not so useless after all (there are those of us that need to produce or evaluate anagrams now and then, for example) will have parallels to real life projects. For example, the exploration of the Fermi Paradox and Drake Equation can serve as a template for a wide range of simulations, and the section on Benford’s law can, well, help you cheat better on your taxes!
This is just plain a fun book, and it is useful, not impractical.