How Many Recursive Cases and Base Cases Does a Recursive Function Need?
Posted by Al Sweigart in python
Let's look at a simple example of a recursive function to see what it needs at minimum.
Writings from the author of Automate the Boring Stuff.
Posted by Al Sweigart in python
Let's look at a simple example of a recursive function to see what it needs at minimum.
Posted by Al Sweigart in misc
Here's the boilerplate that you can copy and paste when creating a new web page with Bootstrap 5.
Posted by Al Sweigart in python
FractalArtMaker is a module for creating fractal art in Python's turtle
module. You can install the module by running pip3 install FractalArtMaker
Posted by Al Sweigart in python
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.
Posted by Al Sweigart in python
Posted by Al Sweigart in programming
Posted by Al Sweigart in programming
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.
Posted by Al Sweigart in python
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.
Posted by Al Sweigart in python
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.
Posted by Al Sweigart in python
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.
Posted by Al Sweigart in python
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.
Posted by Al Sweigart in programming
Here's a hint for programmers writing their resumes: "JavaScript" is spelled as one word, capital-J, capital-S, and no hyphen. But this isn't a blog post about programmers who make typos on their resumes, but about what a minefield of low-quality programming books that Amazon has become.
Posted by Al Sweigart in python
Python has a more concise syntax that uses the in
operator and the multiple values packaged in a tuple. To check if one of multiple variables is one of many values, you can use a list comprehension and the any()
function.
Posted by Al Sweigart in programming
I was one of those kids in the 90s who taught themselves how to code by making video games in the BASIC programming language. Later, I majored in computer science, moved to Silicon Valley, became a software engineer, started writing programming books including Automate the Boring Stuff with Python, and then quit my job to write full-time. I now wake up whenever I want and work from home or nearby cafes. I'm financially secure while being my own boss.
This is a completely true story.*
Posted by Al Sweigart in python
Here are 22 actual, runnable Python code for several recursive functions, written in a style to be understandable by beginners and produce debuggable output.
Posted by Al Sweigart in python
range()
function.
Posted by Al Sweigart in python
Posted by Al Sweigart in programming
Posted by Al Sweigart in python
I created the bitfielddraw
Python module so that you could turn math formulas into .png image files.
Posted by Al Sweigart in programming
The Charisma Machine by Morgan G. Ames is the cautionary tale everyone in tech should read. Five stars.