Python has been the fastest-growing major programming language for several years running. It holds the #1 position across every major industry index, driven by its dominance in AI, data science, and automation.
The 2025 Stack Overflow Developer Survey recorded Python at 57.9% of developers — a 7-point single-year gain, the sharpest in the survey’s history. On GitHub, Python powers roughly half of all new AI projects, with 2.6 million contributors building AI-related work. What makes Python unique is that it is simultaneously the most beginner-friendly major language and the most dominant in the highest-growth sectors of software. For anyone starting to learn programming in 2026, Python is the clearest entry point.
About the book
Invent Your Own Computer Games with Python teaches programming by walking through complete source code for classic games. Instead of presenting abstract concepts first, the book shows you a working game — Hangman, Tic-Tac-Toe, Guess the Number — and explains how each piece works, line by line. You learn by reading, modifying, and eventually writing your own games.
This is a book for absolute beginners. No prior programming experience is required. The author, Al Sweigart, assumes you are starting from zero and guides you through installing Python, understanding basic syntax, and building increasingly complex games. The tone is direct and practical, aimed at readers who want to produce something fun as quickly as possible.
The 2nd edition covers Python 3 and uses the standard library — no external dependencies beyond what ships with Python. All source code is available online.
What you will learn
Through building complete games, readers will gain practical knowledge of: variables, strings, and basic data types; loops, conditionals, and control flow; functions and modular code organization; lists, dictionaries, and data structures; the Cartesian coordinate system for 2D graphics; basic artificial intelligence for simple game opponents; and file input/output for saving high scores. By the end of the book, you will have built over a dozen playable games and gained enough confidence to start your own projects.
Table of contents
- Installing Python
- The Interactive Shell
- Strings
- Writing Programs in IDLE’s File Editor
- Guess the Number
- Jokes
- Dragon Realm
- Using the Debugger
- Flow Charts
- Hangman
- Tic-Tac-Toe
- Bagels
- The Cartesian Coordinate System
- Sonar Treasure Hunt
- Caesar Cipher
- Reversi
- Advanced Reversi AI
- Graphics and Animation with Pygame
- Animating Graphics
- Collision Detection
- Using Sound and Images with Pygame
- A Dodger Game with Graphics, Sound, and Images
Book details
- Title: Invent Your Own Computer Games with Python, 2nd Edition
- Author(s): Al Sweigart
- Publication year: 2012
- Publisher: Self-published
- Pages: 473
- PDF size: 4.84 MB
- Estimated reading time: ~11 h 50 min
- Level: Beginner
- Main category: Programming
- Subcategory: Python
- Language: English
- License: Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States (CC BY-NC-SA 3.0 US)
More books in: Programming, Python
Legal notice: This book is shared for educational purposes only. The content is distributed under Creative Commons licenses or with explicit permission from the author. FreeProgrammingBooks may host files that comply with their respective licenses.