Teaching Kids Programming: Videos on Data Structures and Algorithms
Simple function can draw amazing shapes using Turtle Graphics library and here is a python function to draw a spiral where parameter n is the size of the longest spiral edge and the parameter d is the angle to turn.
from turtle import fd, rt
def spiral(n, d):
for i in range(1, n + 1):
fd(i * 2)
rt(d)
The classic spiral shape that can be obtained via spiral(100, 91):
Turning 89 degree is quite similar but the spiral is tilted anti-clockwise direction.
And here is when the degree is 90 (right angle) – which looks like a maze.
And turning per 100 degree makes a flower pattern:
–EOF (The Ultimate Computing & Technology Blog) —
338 wordsLast Post: Teaching Kids Programming - How to Draw a Chess Board using Python and Turtle Graphics?
Next Post: Teaching Kids Programming - How to Make Flashing Lights on Microbit?



