Download This PDF Book: The Big Book of Small Python Projects: 81 Easy Practice Programs by Al Sweigart
If you’ve mastered basic Python syntax and you’re ready to start writing programs, you’ll find The Big Book of Small Python Projects both enlightening and fun.
This collection of 81 Python projects will have you making digital art, games, animations, counting pro- grams, and more right away. Once you see how the code works, you’ll practice re-creating the programs and experiment by adding your own custom touches.
These simple, text-based programs are 256 lines of code or less. And whether it’s a vintage screensaver, a snail-racing game, a clickbait headline generator, or animated strands of DNA, each project is designed to be self-contained so you can easily share it online.
You’ll create:
• Hangman, Blackjack, and other games to play against your friends or the computer
• Simulations of a forest fire, a million dice rolls, and a Japanese abacus
• Animations like a virtual fish tank, a rotating cube, and a bouncing DVD logo screensaver
• A first-person 3D maze game
• Encryption programs that use ciphers like ROT13 and Vigenère to conceal text
If you’re tired of standard step-by-step tutorials, you’ll love the learn-by-doing approach of The Big Book of Small Python Projects. It’s proof that good things come in small programs!
Review:
"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
"This book is excellent for beginners to Python and a great reference book for programmers who are well versed in programming. I'm happy to give this book 5 out of 5 stars!"
—Greg Walters, Full Circle Magazine
"This book is packed with fun and easy programs, I can confirm."
—BC Gain, @bcamerongain
About the Author
Al Sweigart is a professional software developer who teaches programming to kids and adults. Sweigart has written several bestselling programming books for beginners, including Automate the Boring Stuff with Python, Beyond the Basic Stuff with Python, Invent Your Own Computer Games with Python, Cracking Codes with Python, and Coding with MinecraftCONTENTS IN DETAIL
Contents:
Introduction
Project 1, Bagels: Deduce a secret three-digit number based on clues.
Practice using constants.
Project 2, Birthday Paradox: Determine the probability that two
people share the same birthday in groups of different sizes.
Use Python’s datetime module.
Project 3, Bitmap Message: Display a message on the screen
configured by a 2D bitmap image.
Work with multiline strings.
Project 4, Blackjack: A classic card game played against an AI dealer.
Learn about Unicode characters and code points.
Project 5, Bouncing DVD Logo: Simulates the colorful bouncing DVD
logo of decades past.
Work with coordinates and colorful text.
Project 6, Caesar Cipher: A simple encryption scheme used thousands
of years ago.
Convert between letters and numbers to perform math on text.
Project 7, Caesar Hacker: A program to decrypt Caesar cipher
messages without the encryption key.
Implement a brute-force cryptanalysis algorithm.
Project 8, Calendar Maker: Create calendar pages for a given year
and month.
Use Python’s datetime module and the timedelta data type.
Project 9, Carrot in a Box: A silly bluffing game between two players.
Create ASCII art.
Project 10, Cho-Han: A gambling dice game from feudal Japan.
Practice using random numbers and dictionary data structures.
viii Contents in Detail
Project 11, Clickbait Headline Generator: A humorous headline
generator for your content farm.
Practice string manipulation and text generation.
Project 12, Collatz Sequence: Explore the simplest impossible
conjecture in mathematics.
Learn about the modulus operator.
Project 13, Conway’s Game of Life: The classic cellular automata
whose simple rules produce complex emergent behavior.
Use dictionary data structures and screen coordinates.
Project 14, Countdown: A countdown timer with a seven-segment display.
Practice importing modules you create.
Project 15, Deep Cave: A tunnel animation that descends endlessly
into the earth.
Use string replication and simple math.
Project 16, Diamonds: An algorithm for drawing diamonds of
various sizes.
Practice your pattern recognition skills to create drawing algorithms.
Project 17, Dice Math: A visual dice-rolling math game.
Use dictionary data structures for screen coordinates.
Project 18, Dice Roller: A tool for reading Dungeons & Dragons dice
notation to generate random numbers.
Parse text to identify key strings.
Project 19, Digital Clock: A clock with a calculator-like display.
Generate numbers that match information from the datetime module.
Project 20, Digital Stream: A scrolling screensaver that resembles
The Matrix.
Experiment with different animation speeds.
Project 21, DNA Visualization: An endless ASCII-art double helix
that demonstrates the structure of DNA.
Work with string templates and randomly generated text.
Project 22, Ducklings: Mix and match strings to create a variety of
ASCII-art ducks.
Use object-oriented programming to create a data model for duck drawings.
Project 23, Etching Drawer: Move the cursor to create line drawings.
Work with screen coordinates and relative directional movements.
Project 24, Factor Finder: Find all the multiplicative factors of a number.
Use the modulus operator and Python’s math module.
Project 25, Fast Draw: Test your reflexes to see if you’re the fastest
keyboard in the West.
Learn about the keyboard buffer.
Project 26, Fibonacci: Generate numbers in the famous Fibonacci
sequence.
Implement a rudimentary mathematics algorithm.
Project 27, Fish Tank: A colorful, animated ASCII-art fish tank.
Use screen coordinates, text colors, and data structures.
Project 28, Flooder: Attempt to fill the entire puzzle board with one color.
Implement the flood fill algorithm.
Project 29, Forest Fire Sim: Simulate the spread of wildfires through
a forest.
Create a simulation with adjustable parameters.
Project 30, Four in a Row: A board game where two players try
to connect four tiles in a row.
Create a data structure that mimics gravity.
Project 31, Guess the Number: The classic number guessing game.
Program basic concepts for beginners.
Project 32, Gullible: A humorous program to keep gullible people
busy for hours.
Use input validation and loops.
Project 33, Hacking Minigame: Deduce a password based on clues.
Add cosmetic features to make a basic game more interesting.
Project 34, Hangman and Guillotine: The classic word guessing game.
Use string manipulation and ASCII art.
Project 35, Hex Grid: Programmatically generate tiled ASCII art.
Use loops to make repeating text patterns.
Project 36, Hourglass: A simple physics engine for falling sand.
Simulate gravity and use collision detection.
Project 37, Hungry Robots: Avoid killer robots in a maze.
Create a simple AI for robot movements.
Project 38, J’Accuse!: A detective game to determine liars and truth-tellers
Use data structures to generate relationships between suspects, places, and item clues.
Project 39, Langton’s Ant: A cellular automata whose ants move
according to simple rules.
Explore how simple rules create complex graphical patterns.
Project 40, Leetspeak: Translate English messages into l33t5p34]<.
Use text parsing and string manipulation.
Project 41, Lucky Stars: A push-your-luck dice game.
Practice ASCII art and probability.
Project 42, Magic Fortune Ball: A program to answer your yes/no
questions about the future.
Add cosmetic features to make basic text appear more interesting.
Project 43, Mancala: The ancient two-player board game
from Mesopotamia.
Use ASCII art and string templates to draw a board game.
Project 44, Maze Runner 2D: Try to escape a maze.
Read maze data from text files.
Project 45, Maze Runner 3D: Try to escape a maze . . . in 3D!
Modify multiline strings to display a 3D view.
Project 46, Million Dice Roll Statistics Simulator: Explore the
probability results of rolling a set of dice one million times.
Learn how computers crunch large quantities of numbers.
Project 47, Mondrian Art Generator: Create geometric drawings
in the style of Piet Mondrian.
Implement an art-generating algorithm.
Project 48, Monty Hall Problem: A simulation of the Monty Hall
game show problem. 238
Examine probability with ASCII-art goats.
Contents in Detail xi
Project 49, Multiplication Table: Display the multiplication
table up to 12 × 12.
Practice spacing text.
Project 50, Ninety-Nine Bottles: Display the lyrics to a repetitive song.
Use loops and string templates to produce text.
Project 51, niNety-nniinE BoOttels: Display the lyrics to a repetitive
song that get more distorted with each verse.
Manipulate strings to introduce distortions.
Project 52, Numeral Systems Counters: Examine binary and
hexadecimal numbers.
Use Python’s number conversion functions.
Project 53, Periodic Table of the Elements: An interactive database
of chemical elements.
Parse CSV files to load data into a program.
Project 54, Pig Latin: Translates English messages into Igpay Atinlay.
Use text parsing and string manipulation.
Project 55, Powerball Lottery: Simulate losing at the lottery
thousands of times.
Explore probability using random numbers.
Project 56, Prime Numbers: Calculate prime numbers.
Learn math concepts and use Python’s math module.
Project 57, Progress Bar: A sample progress bar animation to use
in other programs.
Use the backspace-printing technique to create animations.
Project 58, Rainbow: A simple rainbow animation.
Create animation for beginners.
Project 59, Rock Paper Scissors: The classic hand game
for two players.
Implement basic game rules as a program.
Project 60, Rock Paper Scissors (Always-Win Version):
A version of the game where the player cannot lose.
Create the illusion of randomness in a program.
Project 61, ROT13 Cipher: The simplest cipher for encrypting
and decrypting text.
Convert between letters and numbers to perform math on text.
Project 62, Rotating Cube: A rotating cube animation.
Learn 3D rotation and line drawing algorithms.
Project 63, Royal Game of Ur: A 5,000-year-old game
from Mesopotamia.
Use ASCII art and string templates to draw a board game.
Project 64, Seven-Segment Display Module: A display like
those used in calculators and microwave ovens.
Create modules for use in other programs.
Project 65, Shining Carpet: Programmatically generate the
carpet from The Shining.
Use loops to make repeating text patterns.
Project 66, Simple Substitution Cipher: An encryption scheme
more advanced than the Caesar cipher.
Perform intermediate math on text.
Project 67, Sine Message: Display a scrolling wave message.
Use a trigonometry function for animation.
Project 68, Sliding Tile Puzzle: The classic four-by-four tile puzzle.
Employ a data structure to reflect the state of a game board.
Project 69, Snail Race: Fast-paced snail racing action!
Calculate spacing for ASCII art snails.
Project 70, Soroban Japanese Abacus: A computer simulation
of a pre-computer calculating tool.
Use string templates to create an ASCII-art counting tool.
Project 71, Sound Mimic: Memorize an increasingly long
pattern of sounds.
Play sound files from a Python program.
Project 72, sPoNgEcAsE: Translates English messages into
sPOnGEcAsE.
Change the casing of letters in strings.
Project 73, Sudoku Puzzle: The classic nine-by-nine newspaper
deduction puzzle.
Model a puzzle with a data structure.
Project 74, Text-to-Speech Talker: Make your computer
talk to you!
Use your operating system’s text-to-speech engine.
Project 75, Three-Card Monte: The tricky fast-swapping card
game that scammers play on tourists.
Manipulate a data structure based on random movements.
Project 76, Tic-Tac-Toe: The classic two-player board game
of Xs and Os.
Create a data structure and helper functions.
Project 77, Tower of Hanoi: The classic diskstacking puzzle.
Use stack data structures to simulate a puzzle state.
Project 78, Trick Questions: A quiz of simple questions with
misleading answers.
Parse the user’s text to recognize keywords.
Project 79, Twenty Forty-Eight: A casual tile matching game.
Simulate gravity to make tiles “fall” in arbitrary directions.
Project 80, Vigenère Cipher: An encryption scheme so advanced it
remained unbreakable for hundreds of years until computers were invented.
Perform more advanced math on text.
Project 81, Water Bucket Puzzle: Obtain exactly four liters of
water by filling and emptying three buckets.
Use string templates to generate ASCII art
About The Book:
Publisher : No Starch Press
Publication date : June 29, 2021
Language : English
Pages : 434
File : PDF, 10 MB
Free Download the Book: The Big Book of Small Python Projects: 81 Easy Practice Programs by Al Sweigart
PS: Share the link with your friends
If the Download link is not working, kindly drop a comment below, so we'll update the download link for you.
Happy downloading!