Skip to content

Instantly share code, notes, and snippets.

@umcconnell
Created July 16, 2020 10:26
Show Gist options
  • Save umcconnell/fcb00ff25acf101b72d4e67f0b4ff12f to your computer and use it in GitHub Desktop.
Save umcconnell/fcb00ff25acf101b72d4e67f0b4ff12f to your computer and use it in GitHub Desktop.
Spiralling shapes with Python turtle
import turtle
turtle.speed(0)
def spiralling_shape(sides: int = 4, iterations: int = 200, scale: int = 1):
for i in range(iterations):
turtle.forward(i*scale)
turtle.left(360//sides + 1)
# Make a spiralling square
spiralling_shape()
# Or a spiralling triangle scaled by factor 3
spiralling_shape(sides=3, scale=3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment