Learn to program. For free.
Learning to program makes you a smarter and more capable human being. Rocket science uses programming, but programming isn't rocket science. Whether you're a student preparing for a software career, an office worker buried under spreadsheet files, or a hobbyist who wants to make video games, the Python programming language is an excellent start in the world of programming.
I'm Al Sweigart, and I write books to teach beginners to code. I put them online for free because programming is too valuable and needs to be accessible to all. (You can also buy print and ebooks versions.) My approach takes out the intimidation so that you can become productive and enjoy the creative aspects of coding.
Get started today. And good luck on your programming journey!
Third Edition Now Available
The third edition of Automate the Boring Stuff with Python is now available on the No Starch Press website. If you buy the print book from No Starch, you'll immediately receive the ebook in PDF, EPUB, and Kindle format.
What's new in the third edition?
Books by Al Sweigart
Automate the Boring Stuff with Python, 3rd Edition
Learn Coding for Automation Everyone in the 21st century needs to learn to code, right? But not everyone needs to become a software engineer or computer scientist. Automate the Boring Stuff with Python is written for office workers, students, administrators, and anyone who uses a computer how to write small, practical programs to automate tasks on their computer.
You don't need to know all the complexities of algorithms and syntax, you just want to write basic programs to automate mundane computer tasks. In the process, even total beginners will learn to use Python to control their computers without having to learn complex information about computer science. This is a practical programming guide for the rest of us.
You can also take the video course of this book. Use this link to purchase the course for about $14 (about a 70% discount!)
Buy from Publisher (Free ebook!) Buy on Amazon Read Online for Free
The Recursive Book of Recursion
Recursion, Understandable by Humans Recursion, and recursive algorithms, have a reputation for being intimidating. They're seen as an advanced computer science topic often brought up in coding interviews. Moreover, coders often perceive the use of a recursive algorithm as a sophisticated solution that only true programmers can produce. But there's nothing magical about recursion. Its fearsome reputation is more a product of poor teaching than of the complexity of recursion itself.
This book teaches the basics of recursion, exposes the ways it's often poorly taught, and clarifies the fundamental principles behind all recursive algorithms. It is project-based, containing complete, runnable programs in both Python and JavaScript, and covers several common recursive algorithms for tasks like calculating factorials, producing numbers in the Fibonacci sequence, tree traversal, maze solving, binary search, quicksort and merge sort, Karatsuba multiplication, permutations and combinations, and solving the eight queens problem.
The book also explains tail call optimization and memoization, concepts often employed to produce effective recursive algorithms, and the call stack, which is a critical part of how recursive functions work but is almost never explicitly pointed out in lessons on recursion. The last chapter, on fractals, culminates with examples of the beautiful fractal shapes recursion can produce.
Buy from Publisher (Free ebook!) Buy on Amazon Read Online for Free
Python Programming Exercises, Gently Explained
Simple Exercises to Improve Your Skills Many books and websites have aggressive programming challenges for top coders. However, Python Programming Exercises, Gently Explained is for the rest of us. We want challenges that improve our coding skills, not leave us confused and discouraged. Other tutorials and books have taught you the basics of Python, but the 42 programming exercises in this book let you practice what you've learned. Selected for their simplicity, these programming problems include gentle explanations of the problem, the prerequisite coding concepts you’ll need to understand the solution, and helpful templates to put together the programs if you have trouble starting from scratch.
This is the perfect book for beginner and intermediate programmers who want to test their Python skills but aren’t ready to begin professional-level software development. You don’t need the frustration of being expected to create complex algorithms and computer science theory; you need a large set of programming challenges that meet you at your level, with gentle explanations.
The professionally-formatted ebook is available on Amazon for 99 cents.
Buy on Amazon Read Online for Free
The Big Book of Small Python Projects
81 Easy Practice Programs 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! Watch a video trailer of the projects in this book.
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 programs, 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
Buy from Publisher (Free ebook!) Buy on Amazon Read Online for Free
Beyond the Basic Stuff with Python
Bridge the Gap Between Novice and Professional You've completed a basic Python programming tutorial or finished Al Sweigart's best selling Automate the Boring Stuff with Python. What's the next step toward becoming a capable, confident software developer?
Welcome to Beyond the Basic Stuff with Python. More than a mere collection of advanced syntax and masterful tips for writing clean code, you'll learn how to advance your Python programming skills by using the command line and other professional tools like code formatters, type checkers, linters, and version control. Sweigart takes you through best practices for setting up your development environment, naming variables, and improving readability, then tackles documentation, organization and performance measurement, as well as object-oriented design and the Big-O algorithm analysis commonly used in coding interviews. The skills you learn will boost your ability to program—not just in Python but in any language.
Buy from Publisher (Free ebook!) Buy on Amazon Read Online for Free
Coding with Minecraft
Program Robots in Minecraft You've mined for diamonds, crafted dozens of tools, and built all sorts of structures—but what if you could program robots to do all of that for you in a fraction of the time?
In Coding with Minecraft, you'll create a virtual robot army with Lua, a programming language used by professional game developers. Step-by-step coding projects will show you how to write programs that automatically dig mines, collect materials, craft items, and build anything that you can imagine. Along the way, you'll explore key computer science concepts like data types, functions, variables, and more.
Buy from Publisher (Free ebook!) Buy on Amazon Read Online for Free
Cracking Codes with Python
Encrypt Messages and Hack Ciphers Cracking Codes with Python teaches complete beginners how to program in the Python programming language. The book features the source code to several ciphers and hacking programs for these ciphers. The programs include the Caesar cipher, transposition cipher, simple substitution cipher, multiplicative & affine ciphers, Vigenere cipher, and hacking programs for each of these ciphers. The final chapters cover the modern RSA cipher and public key cryptography.
Buy from Publisher (Free ebook!) Buy on Amazon Read Online for Free
Invent Your Own Computer Games with Python, 4th Edition
Create Computer Games Invent Your Own Computer Games with Python teaches you how to program in the Python language. Each chapter gives you the complete source code for a new game, and then teaches the programming concepts from the examples. Games include Guess the Number, Hangman, Tic Tac Toe, and Reversi. This book also has an introduction to making games with 2D graphics using the Pygame framework.
Buy from Publisher (Free ebook!) Buy on Amazon Read Online for Free
Scratch 3 Programming Playground
Graphical Game Programming for Kids Scratch 3 Programming Playground teaches you how to program in Scratch, the graphical programming language from MIT for ages 8 to 16. It features 8 game and art projects.
Scratch 3 Programming Playground is for young adults or parents/teachers who want to lead kids through a fun programming journey. Additionally, there are also many video tutorials on YouTube from the author's website, Invent with Scratch.
There is also an online Udemy course that follows the book, and you can sign up for free.
Buy from Publisher (Free ebook!) Buy on Amazon Read Online for Free
Making Games with Python & Pygame
Make Python Games with Graphics Making Games with Python & Pygame covers the Pygame library with the source code for 11 games. Making Games was written as a sequel for the same age range as Invent with Python. Once you have an understanding of the basics of Python programming, you can now expand your abilities using the Pygame library to make games with graphics, animation, and sound.
The book features the source code to 11 games. The games are clones of classics such as Nibbles, Tetris, Simon, Bejeweled, Othello, Connect Four, Flood It, and others.
Buy on Amazon Read Online for Free
Online Video Courses
You can supplement your book reading with Udemy online video courses for "Automate the Boring Stuff with Python" and "Scratch Programming Playground". Use these links to receive large discounts:


YouTube Videos
There are several programming tutorial videos I create on my YouTube channel:
- Free preview of my "Automate the Boring Stuff with Python" Udemy course
- Beyond the Basic Stuff with Python video series following the book.
- Calm Programming, a no-commentary series where I write programs for chill vibes viewing.
Donate
All of my books are free under a Creative Commons license and have been part of Humble Book Bundles benefitting charities. If you'd like to help me out, there are several options:
There are several ways you can support the author:
Write a review on Amazon helps get the word out about my books:
- Python Programming Exercises, Gently Explained
- The Recursive Book of Recursion
- The Big Book of Small Python Projects
- Beyond the Basic Stuff with Python
- Coding with Minecraft
- Automate the Boring Stuff with Python
- Cracking Codes with Python
- Invent Your Own Computer Games with Python, 4th Edition
- Making Games with Python & Pygame
- Scratch 3 Programming Playground
About the Author
Al Sweigart is a software developer, tech book author, artist, and Fellow of the Python Software Foundation. He is the maintainer of several open source projects, including PyAutoGUI and pyperclip. He is originally from Texas, and has lived in the Bay Area, the Pacific Northwest, and New York. Reports that Al is an AI have been grossly exaggerated.