June 2021
Beginner
432 pages
9h 9m
English
This short program produces a tessellated image of a hexagonal grid, similar to chicken wire. It shows that you don’t need a lot of code to make something interesting. A slightly more complicated variation of this program is Project 65, “Shining Carpet.”
Note that this program uses raw strings, which prefix the opening quote with a lowercase r so that the backslashes in the string aren’t interpreted as escape characters.
Figure 35-1 shows what the output will look like when you run hexgrid.py.
Read now
Unlock full access