Learn to Program. For Free.

Learning to program makes you a smarter and more capable human being. Computers are not only the most common tool we encounter in our day-to-day lives, but also the most powerful. Even if your plans don't include becoming a software engineer writing code for the next Mars mission, you can find value in learning to code.

Rocket science uses programming, but programming isn't rocket science. Whether you're preparing for a software career, an office worker with a folder full of spreadsheet files, or a hobbyist interested in making indie video games, the Python programming language is a great way to get started 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. (Though I sell print and ebooks to pay rent.)

Get started. It's a great journey.

Programming Books by Al Sweigart

"Introductions to Python are easy to find. But at the end of the day most Python tutorials for beginners end up being the same lessons repackaged, often leaving the new programmer with gaping holes in how their newly acquire skills can be applied practically. This is not one of those books. Where this book stands out is the second part where you actually build useful tools you might need to use every day. The author does a fantastic job of bridging the concepts and skills you learned earlier to real world applications."

Nicholas Sarlo Read full Amazon review

"This book is totally appropriate for someone who has never programmed before. Everything is explained, right from the ground up, in a lively, interesting style which doesn't dumb things down."

J. Hartley, tartley.com Read full Amazon review

"I am a college professor who occasionally teaches courses for liberal arts students. [...] I offered a game programming course in the Python programming language using Sweigart's book. The students loved this book. It starts at the very beginning and leads them, game by fascinating game, to become highly capable programmers."

Dr. Robert C. Gann Read full Amazon review

"I'm halfway through this book and very pleased. I have never seen a programming book so accessible to complete beginners. It really gave me the jump start I needed. I use it alongside other resources, but it continues to be the easiest to absorb."

Jared Walters Read full Amazon review

"I used to write a column on a greek magazine about learning Python and PyGame. [...] Since I found this book, every time the topic of learning programming is mentioned - especially from a person interested on making games - I point people to it."

Konstantinos Michalopoulos Read full Amazon review

"It is difficult to write a clear and easy to understand book on programming for a beginner. It is even more difficult to write a clear and understandable book on cryptography for a beginner. To do both at the same time is nearly impossible, but this author has nailed it."

jstine Read full Amazon review

"My name is Felix. I'm ten years old, and I really liked your book on game programming with python."

Felix D. (in an email to the author)

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 coupon code INVENT_WITH_PYTHON to buy the course for $10, an 80% discount!

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 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 Programming Playground

Scratch 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 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. You can sign up for free using the coupon code INVENT_WITH_SCRATCH.

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:

Programming Book Recommendations

Python Crash Course - Excellent beginner book on par with "Automate the Boring Stuff with Python".

Teach Your Kids to Code - A great book for parents and teachers who want to help young adults learn to program.

Learn to Program with Minecraft - If your kid likes Minecraft, they'll love using Python to programmatically control their virtual blocky world.

Python for Kids - Similar to "Invent Your Own Computer Games with Python", for kids and beginners.

Python Pocket Reference - A concise guide to Python for those with some programming experience.

Learning Python - The classic, comprehensive introduction to Python.

The Quick Python Book - A great book for experienced programmers who are new to Python.

Fluent Python - A great intermediate Python book for those looking for the next step.

Effective Python - Also a great intermediate Python book for those looking for the next step.

Core Python Applications Programming - A thorough Python book for experienced developers.

The Linux Command Line - An introduction to the command line, a useful skill for any programmer.

Black Hat Python - Python programming for hackers and pentesters.

Violent Python - A cookbook for hackers, forensic analysts, penetration testers and security engineers.