Fractals are beautiful, self-similar patterns that can be created by a computer from very simple rules. My Fractal Art Maker package makes it easy to use Python's turtle.py package to draw your own. You don't need to know recursion, but you can read my free book, The Recursive Book of Recursion if you're curious. If you want to learn how to draw pictures with Python code, I also have The Simple…
I've been working on turtle-related projects and I needed a simple, interactive, single-file Python program to explain RGB color values. I wrote this one up as part of my work writing a Simple Turtle Tutorial written in Wikipedia-style Simple English so it can be translated to non-English languages. You can download the app from PyPI and look at its code on its git repo
" This workbook transforms Al Sweigart’s best-selling guide from a reading experience into a coding experience. Following Automate the Boring Stuff with Python chapter by chapter, this workbook will help you turn concepts into muscle memory through carefully designed exercises, projects, and real Python scripts." Preorder links: Direct From the Publisher (preferred) | Amazon | Barnes and Noble |…
I created a web app for aligning before/after photos . Ony of my hobbies is picking up litter, and I'll post before/after photos to the r/detrashed subreddit:
After you've learned the basic concepts, the best way to improve your coding skills is to work on projects. You may not know enough to contribute to popular open source projects, but you can create small programs on your own. Here's a list of 81 projects suitable for beginners. They're short, can be done in any language, and don't require additional software library installation. These projects…
I wrote some Python scripts to help me create the HTML web pages for an online version of Maze, a 1985 visual puzzle book by Christopher Manson that was a large inspiration for Blue Prince (my personal game of the year for 2025). I'm hosting it at https://inventwithpython.com/mazewebsite/
For Halloween 2024, I made a Recursive Fract-Al costume. It was literally an exponential amount of work! The idea came to me when I was writing The Recursive Book of Recursion
I needed a complete list of valid color names for Python's Tkinter package as part of my ButtonPad GUI framework development. The lists I found on the internet were either incomplete, buried under ads, and often just plain wrong. Here's a list of all 760 color names (valid and personally tested) for Python Tkinter.
Over the past week I've been experimenting with vibe coding : asking LLMs such as ChatGPT, Claude, and Gemini write entire apps as if I had absolutely no programming ability at all. LLMs can easily solve programming challenges or interview questions. But I wanted to see how far the current LLMs can go when asked to make complete apps, and what kinds of failure patterns emerge. From the role of a…
The nominees for the Python Software Foundation's Board of Directors 2025 election have been announced. You can find a full list on the nominees page . This year there are 4 seats open on the PSF Board. You can see who is currently on the board on the PSF Officers & Directors page . I'm pleased to announce I'm endorsing the following nominees: Abigail Dogbe, Archana Vaidheeswaran, Daniele Procida,…
There is a phrase used when teaching recursion and recursive functions, leap of faith . In researching my book, The Recursive Book of Recursion , I found that most explanation of this technique were vague or even misleading. In this article, I'll go into what the leap of faith is and how it can help you write your recursive functions.
The third edition of Automate the Boring Stuff with Python is now available for purchase or to read for free online . It has updated content and several new chapters, but one chapter that was left on the cutting room floor was "Working with Audio, Video, and Webcams" . I present the 26-page rough draft chapter in this blog, where you can learn how to write Python code that records and plays…
TurtleSC provides a mini-language of shortcut instructions to carry out turtle.py function calls, like 'f 100' instead of forward(100) . Git Repo , PyPI Project Page .
This article and its content were written, reviewed, and verified by a human, Al Sweigart. In my research I found that most "GitHub vs GitLab" articles are AI slop containing false or outdated information. I wrote this article with links to actual documentation pages, and not just copying what every other article on this topic says. For those who have heard of this "Git stuff," here's a summary of…
At PyCon 2025, I handed out a pocket-sized zine that lets you play a procedurally generated choose-your-own-adventure version of tic-tac-toe. The zine itself is available as a PDF for viewing on your computer and a PDF for double-sided printing . Here's how I made it using Python.
Part 5 of a tutorial series on the Fabric.js canvas/graphics library for JavaScript, we'll learn how to change the size of shapes by scaling them with the scale() method. We'll also get some more practice drawing in general. We'll draw this forest:
Part 4 of a tutorial series on the Fabric.js canvas/graphics library for JavaScript, where we learn about drawing with paths.round color of a canvas as well as the shapes fabric.Polygon and fabric.Line .
Part 3 of a tutorial series on the Fabric.js canvas/graphics library for JavaScript, where we learn how to set the background color of a canvas as well as the shapes fabric.Polygon and fabric.Line .
This is Part 2 of the Fabric.js tutorial canvas/graphics library for JavaScript, where we learn about Polyline shapes and styling shapes by drawing a gingerbread figure.
This is part 1 my tutorial series on the Fabric.js canvas/graphics library for JavaScript, where we learn about drawing basic shapes like rectangles, circles, and triangles to draw pine trees.
Tweening functions allow you to easily add many different styles of natural-seeming movement to the graphics in your program. In this blog post, you'll learn about how tweening functions can make more lively movement animations using Pygame and the PyTweening third-party library. Tweening functions apply to any programming language, but this tutorial has actual Python code for you to run and…
4 stars. I came across Selçuk Artut’s Geometric Patterns with Creative Coding while researching several topics on computer-generated art for beginners. I admit, the single 1-star review for this book annoyed me enough to read and review. I’ve come away believing that this book certainly deserves wider and better attention than that.
The third edition is has new chapters, programming projects, and revised editing. The third party module coverage has been updated to the latest available version (including OpenPyXL). You can run pip install automateboringstuff3 to install the latest version of all modules covered in the book that are compatible with the book's code examples.
My 2022 book, The Recursive Book of Recursion ( read online for free , buy direct from the publisher ) covers recursive algorithms, a notoriously tricky subject for programmers and computer science students. I feel like I did a good job writing it (and my editors at No Starch Press did an incredible job editing it), but I wondered how well Large Language Models (LLMs) like ChatGPT could understand…
5 stars. Python Distilled has a perfectly suited title: This book is for experienced programmers who want to learn Python and need the Python programming language's core syntax, standard library, and Pythonic idioms. However, if you're a developer who wants to add Python to your toolbox, I recommend Python Distilled as one of the first books you should read.
5 stars. Python in a Nutshell is an excellent book for professional developers who have some experience with Python but want to take the leap to being a senior Python developer, Python in a Nutshell is required reading.
As you can tell from the lengthy title, there are many linting tools for Python. Some of them have near-identical names as each other. In November 2022, I upgraded my text editor to Sublime Text 4 and then took the opportunity to spend a few hours reviewing all of the Python linters I could find. After personally reviewing all of them, I've selected the following as must-haves: Pyflakes, Mypy, and…
I like to program computers. An army of a million file clerks wouldn't be as productive as my laptop running the right code. And my house only has one bathroom so the line would be quite long too...
JavaScript is not the only programming language you can run in the browser. Brython is a Python interpreter implemented in JavaScript so you can run Python code in your browser. This lets you have a Python interactive shell without having to install Python. You can also write Python code to interact with the DOM and create browser apps just like you could with JavaScript. The primary downside is…
Installing Python is easy, but maybe you're on a smartphone/tablet, are on a library computer that doesn't let you install software, or can't install Python for some other reason. This article has a list of 10 free Python interpreters and interactive shells (also called REPLs) that you can access from a web browser.
Programming and hacking in movies often involves streams of ones and zeros flowing across the screen. This looks mysterious and impressive, but what do these ones and zeros actually mean? You're probably aware that binary numbers (numbers written using only the two digits, zero and one) have something to do with computers but don't know why.
The short answer is: Python is interpreted. But it can also be considered compiled, both compiled and interpreted, and neither compiled nor interpreted. Read on to untangle these definitions.
Installing Python modules with the pip tool is surprisingly hard to describe to beginners learning to code. There are several potential issues: multiple Python installations, virtual environments, PATH environment variable settings. You have to introduce command-line terminals and file system navigation, and the differences between Windows and Mac/Linux. However, there is a line of code you can…
Regular expressions (aka regexes) are a mini-language to specify a pattern of text to look for. However, regex syntax is composed of various punctuation marks that can be hard to remember. Humre is a Python module that gives a more human-readable syntax that works better with code editing tools. You can install Humre just like any other Python module with pip install humre and the full…
I've been writing programming books for beginners since 2009. All of them are free to read online at InventWithPython.com Many people email me asking which of my books they should read, so I wrote this guide to help beginners get started with my free learning materials.
My new programming book, the Recursive Book of Recursion, is released in August 2022. The book covers several classic recursive algorithms and breaks down recursion's fearsome reputation as a programming technique. The book has the code for its numerous programs in both Python and JavaScript. When you buy it direct from the publisher, No Starch Press , you'll receive a DRM-free ebook copy with…
Python 3.11 will include a TOML parsing module called tomllib . Let's learn what TOML files are (they're similar to JSON), how they're useful for configuration files, and how you can write Python code to read them.
You don't need to buy a new computer to learn programming. It's a common misconception that you need a powerful computer to program. This guide will give you some hints to guide you in the right direction.
Mark H. Liu’s “Make Python Talk” is a solid book for anyone who wants to leverage the power of the Python programming language to add speech capabilities to their programs. The chapters cover third-party libraries for speech recognition and text-to-speech in an engaging way.
Serious Python by Julien Danjou is an excellent book for those who have gone through the "hello world" tutorials or those coming to Python from other programming languages, and want a book that teaches you not just how to write code, but how to write code the pythonic way.
Writing for an intermediate audience is hard, but Ken Youens-Clark has nailed it with Tiny Python Projects. This is a great book for those who have dabbled with a few beginner Python tutorials but still feel like they don't "get" programming. The projects in this book are short and simple; perfect for beginners who want to get experience with actual programs instead of just code snippets.
This blog post examines different ways that Python lists and dictionaries can be used to represent a 2D data structure. I also write some test programs to measure the performance of each data structure.