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!

New Books!

Python Programming Exercises, Gently Explained is 99 cent ebook with 42 programming challenges for beginners. The Recursive Book of Recursion: Ace the Coding Interview with Python and JavaScript takes you from beginner of this intimidating programming topic to mastery.

Programming Books by Al Sweigart

Cover of Automate the Boring Stuff with Python

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 online course of this book on Udemy. Use this link to purchase the course for about $14 (about a 70% discount!)

Cover of The Recursive Book of Recursion

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.

You can get a free review copy of this ebook!

Cover of Python Programming Exercises, Gently Explained

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.

Cover of The Big Book of Small Python Projects

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

You can get a free review copy of this ebook!

Cover of Beyond the Basic Stuff with Python

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.

You can get a free review copy of this ebook!

Cover of Coding with 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.

You can get a free review copy of this ebook! (Scroll to the bottom of this link for info.)

Cover of Cracking Codes with Python

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.

You can get a free review copy of this ebook!

Cracking Codes with Python is the new edition of the older book, Hacking Secret Ciphers with Python.

Cover of Invent Your Own Computer Games with Python

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.

You can get a free review copy of this ebook!

Cover of Scratch 3 Programming Playground

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. (This course covers the old Scratch 2 version. It will be updated in the future.)

You can get a free review copy of this ebook!

Cover of Making Games with Python & Pygame

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.

Udemy Online 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:


All of my books are free to download and share 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:

About Al Sweigart

Al Sweigart is a software developer and tech book author. Python is his favorite programming language, and he is the developer of several open source modules for it. His cat weighs 11 pounds.

Email | Mastodon | Twitter | Twitch | YouTube | GitHub | Blog | Patreon | Amazon Author | LinkedIn