The Invent with Python Blog

Writings from the author of Automate the Boring Stuff.

New Book: The Big Book of Small Python Projects

Sat 26 June 2021    Al Sweigart

My new book, The Big Book of Small Python Projects, is now available from No Starch Press. You can get the ebook for free when you purchase a print book from No Starch Press. Or you can buy the book off Amazon.

Read "The Big Book of Small Python Projects" online for free.

This book contains 81 small but complete programming projects written in Python. These projects are designed to help new programmers who have learned the basics see what real programs "look like". These aren't code snippets, but actual, full programs that you can run. At the same time, they are small enough so that their source code is easy to understand.

Watch this book's video trailer created by the author.

Episode 64 of the Teaching Python Podcast discusses the book.

If you've followed some basic Python tutorials but feel like programming hasn't quite "clicked" yet, this is the book to read. Or, if you are new to programming but adventureous enough to just dive into code, these programs are simple enough to be understood to new programmers as well.

Many of these projects come from my old "STDIO game jam" projects in this git repo on GitHub. You can also find the source code of the programs in the book in the downoadable resources file on the No Starch Press page for the book.

Praise for The Big Book of Small Python Projects

"I've always been impressed by the variety of simple, but interesting and fun, projects Al can come up with and this collection takes that to the next level... Even experienced coders are likely to be pulled into browsing through the wide variety that Al has put into this book."
—Naomi Ceder, Fellow of the Python Software Foundation

"Al Sweigart presents fun programs, inspiring learners to tweak them. That's how I learned to program: tinkering with examples from books and magazines. It works!"
–Luciano Ramalho, Technical Principal at ThoughtWorks and author of Fluent Python

"Whether you're new to Python or want to exercise your coding brain, I recommend The Big Book of Small Python Projects to spark your thinking. Both the 'big' and the 'small' in the title are accurate. There are a lot of projects in this book, but most code takes up only a page or two. That makes it a fun reference book to get you into the flow or kick off a session in your terminal."
–Adam DuVander, Founder, EveryDeveloper

Project Descriptions

  • Project 1, Bagels: Deduce a secret three-digit number based on clues.
  • Project 2, Birthday Paradox: Determine the probability that two people share the same birthday in groups of different sizes.
  • Project 3, Bitmap Message: Display a message on the screen configured by a 2D bitmap image.
  • Project 4, Blackjack: A classic card game played against an AI dealer.
  • Project 5, Bouncing DVD Logo: Simulates the colorful bouncing DVD logo of decades past.
  • Project 6, Caesar Cipher: A simple encryption scheme used thousands of years ago.
  • Project 7, Caesar Hacker: A program to decrypt Caesar cipher messages without the encryption key.
  • Project 8, Calendar Maker: Create calendar pages for a given year and month.
  • Project 9, Carrot in a Box: A silly bluffing game between two players.
  • Project 10, Cho-Han: A gambling dice game from feudal Japan.
  • Project 11, Clickbait Headline Generator: A humorous headline generator for your content farm.
  • Project 12, Collatz Sequence: Explore the simplest impossible conjecture in mathematics.
  • Project 13, Conway’s Game of Life: The classic cellular automata whose simple rules produce complex emergent behavior.
  • Project 14, Countdown: A countdown timer with a seven-segment display.
  • Project 15, Deep Cave: A tunnel animation that descends endlessly into the earth.
  • Project 16, Diamonds: An algorithm for drawing diamonds of various sizes.
  • Project 17, Dice Math: A visual dice-rolling math game.
  • Project 18, Dice Roller: A tool for reading Dungeons & Dragons dice notation to generate random numbers.
  • Project 19, Digital Clock: A clock with a calculator-like display.
  • Project 20, Digital Stream: A scrolling screensaver that resembles The Matrix.
  • Project 21, DNA Visualization: An endless ASCII-art double helix that demonstrates the structure of DNA.
  • Project 22, Ducklings: Mix and match strings to create a variety of ASCII-art ducks.
  • Project 23, Etching Drawer: Move the cursor to create line drawings.
  • Project 24, Factor Finder: Find all the multiplicative factors of a number.
  • Project 25, Fast Draw: Test your reflexes to see if you’re the fastest keyboard in the West.
  • Project 26, Fibonacci: Generate numbers in the famous Fibonacci sequence.
  • Project 27, Fish Tank: A colorful, animated ASCII-art fish tank.
  • Project 28, Flooder: Attempt to fill the entire puzzle board with one color.
  • Project 29, Forest Fire Sim: Simulate the spread of wildfires through a forest.
  • Project 30, Four in a Row: A board game where two players try to connect four tiles in a row.
  • Project 31, Guess the Number: The classic number guessing game.
  • Project 32, Gullible: A humorous program to keep gullible people busy for hours.
  • Project 33, Hacking Minigame: Deduce a password based on clues.
  • Project 34, Hangman and Guillotine: The classic word guessing game.
  • Project 35, Hex Grid: Programmatically generate tiled ASCII art.
  • Project 36, Hourglass: A simple physics engine for falling sand.
  • Project 37, Hungry Robots: Avoid killer robots in a maze.
  • Project 38, J’Accuse!: A detective game to determine liars and truth-tellers.
  • Project 39, Langton’s Ant: A cellular automata whose ants move according to simple rules.
  • Project 40, Leetspeak: Translate English messages into l33t5p34]<.
  • Project 41, Lucky Stars: A push-your-luck dice game.
  • Project 42, Magic Fortune Ball: A program to answer your yes/no questions about the future.
  • Project 43, Mancala: The ancient two-player board game from Mesopotamia.
  • Project 44, Maze Runner 2D: Try to escape a maze.
  • Project 45, Maze Runner 3D: Try to escape a maze... in 3D!
  • Project 46, Million Dice Roll Statistics Simulator: Explore the probability results of rolling a set of dice one million times.
  • Project 47, Mondrian Art Generator: Create geometric drawings in the style of Piet Mondrian.
  • Project 48, Monty Hall Problem: A simulation of the Monty Hall game show problem.
  • Project 49, Multiplication Table: Display the multiplication table up to 12 × 12.
  • Project 50, Ninety-Nine Bottles: Display the lyrics to a repetitive song.
  • Project 51, niNety-nniinE BoOttels: Display the lyrics to a repetitive song that get more distorted with each verse.
  • Project 52, Numeral Systems Counters: Examine binary and hexadecimal numbers.
  • Project 53, Periodic Table of the Elements: An interactive database of chemical elements.
  • Project 54, Pig Latin: Translates English messages into Igpay Atinlay.
  • Project 55, Powerball Lottery: Simulate losing at the lottery thousands of times.
  • Project 56, Prime Numbers: Calculate prime numbers.
  • Project 57, Progress Bar: A sample progress bar animation to use in other programs.
  • Project 58, Rainbow: A simple rainbow animation.
  • Project 59, Rock Paper Scissors: The classic hand game for two players.
  • Project 60, Rock Paper Scissors (Always-Win Version): A version of the game where the player cannot lose.
  • Project 61, ROT13 Cipher: The simplest cipher for encrypting and decrypting text.
  • Project 62, Rotating Cube: A rotating cube animation.
  • Project 63, Royal Game of Ur: A 5,000-year-old game from Mesopotamia.
  • Project 64, Seven-Segment Display Module: A display like those used in calculators and microwave ovens.
  • Project 65, Shining Carpet: Programmatically generate the carpet from The Shining.
  • Project 66, Simple Substitution Cipher: An encryption scheme more advanced than the Caesar cipher.
  • Project 67, Sine Message: Display a scrolling wave message.
  • Project 68, Sliding Tile Puzzle: The classic four-by-four tile puzzle.
  • Project 69, Snail Race: Fast-paced snail racing action!
  • Project 70, Soroban Japanese Abacus: A computer simulation of a pre-computer calculating tool.
  • Project 71, Sound Mimic: Memorize an increasingly long pattern of sounds.
  • Project 72, sPoNgEcAsE: Translates English messages into sPOnGEcAsE.
  • Project 73, Sudoku Puzzle: The classic nine-by-nine newspaper deduction puzzle.
  • Project 74, Text-to-Speech Talker: Make your computer talk to you!
  • Project 75, Three-Card Monte: The tricky fast-swapping card game that scammers play on tourists.
  • Project 76, Tic-Tac-Toe: The classic two-player board game of Xs and Os.
  • Project 77, Tower of Hanoi: The classic disk- stacking puzzle.
  • Project 78, Trick Questions: A quiz of simple questions with misleading answers.
  • Project 79, Twenty Forty-Eight: A casual tile matching game.
  • Project 80, Vigenère Cipher: An encryption scheme so advanced it remained unbreakable for hundreds of years until computers were invented.
  • Project 81, Water Bucket Puzzle: Obtain exactly four liters of water by filling and emptying three buckets.

Learn to program for free with my books for beginners:

Sign up for my "Automate the Boring Stuff with Python" online course with this discount link.

Email | Mastodon | Twitter | Twitch | YouTube | GitHub | Blog | Patreon | LinkedIn | Personal Site