Part I: Warming Up
Chapter 1: The Koch Snowflake
Chapter 2: Spirographs
Part II: Simulating Life
Chapter 3: Conway’s Game of Life
Chapter 4: Musical Overtones with the Karplus-Strong Algorithm
Chapter 5: Flocking Boids
Part III: Fun with Images
Chapter 6: ASCII Art
Chapter 7: Photomosaics
Chapter 8: Autostereograms
Part IV: Enter 3D
Chapter 9: Understanding OpenGL
Chapter 10: Conway’s Game of Life on a Torus
Chapter 11: Volume Rendering
Part V: Hardware Hacking
Chapter 12: The Karplus-Strong Algorithm on a Raspberry Pi Pico
Chapter 13: Laser Audio Display with a Raspberry Pi
Chapter 14: IoT Garden
Chapter 15: Audio ML on Pi
A Python Installation
B Rasberry Pi Setup
Python Playground, 2nd Edition
Harness the power of Python as you turn code into tangible creations with Python Playground, a collection of 15 inventive projects that will expand your programming horizons, spark your curiosity, and elevate your coding skills.
Go beyond the basics as you write programs to generate art and music, simulate real-world phenomena, and interact with hardware, all through the use of Python and common libraries such as numpy, matplotlib, and Pillow.
As you work through the book’s projects, you will:
- Craft intricate Spirograph-like designs with parametric equations and the turtle module
- Generate music by synthesizing plucked string sounds
- Transform everyday images into ASCII art, photomosaics, and eye-popping autostereograms
- Design engaging cellular automata and flocking simulations
- Explore the realm of 3D graphics, from basic shape rendering to visualizing MRI scan data
- Build a Raspberry Pi–powered laser show that dances along with music
New to this edition: We’ve expanded your playground with five new projects: you’ll draw fractals, bring Conway’s Game of Life into 3D space, and use a Raspberry Pi and Python to create a musical instrument, an IoT garden monitor, and even a machine learning–driven speech recognition system.
Whether you’re a seasoned professional or just getting started, you’ll find Python Playground to be a great way to learn, experiment with, and master this versatile programming language.
"Python Playground has excellent projects for the science-minded programmer, the programming-minded science enthusiast, and everyone in between."
—Al Sweigart, author of Automate the Boring Stuff with Python
Reviews of the first edition:
"If you want to become adept at doing clever things with Python, I doubt you'll find a better group of projects or more useful help for understanding how the language works."
"This is a book that belongs in every Python programmer's library."
—Full Circle Magazine
"Packed with interesting projects."
"Python Playground targets programmers who want to further improve their skills and knowledge of the language. The book does a good job of explaining all relevant details and makes sure that readers get a clear picture of what is going on."