Skip to content

Instantly share code, notes, and snippets.

@mikelane
Created November 14, 2018 21:43
Show Gist options
  • Save mikelane/560dcb85aba54d3ed6135ce7659f55b8 to your computer and use it in GitHub Desktop.
Save mikelane/560dcb85aba54d3ed6135ce7659f55b8 to your computer and use it in GitHub Desktop.
def draw_square(side_length: int) -> None:
for _ in range(4):
turtle.forward(side_length)
turtle.right(90)
def draw_concentric_squares(number_of_squares: int = 5, radius_increase: int = 20) -> None:
turtle.begin_fill()
for length in range(radius_increase, 2 * number_of_squares * radius_increase, radius_increase * 2):
draw_square(length)
x, y = turtle.pos()
turtle.penup()
turtle.setpos(x - radius_increase, y + radius_increase)
turtle.pendown()
turtle.done()
draw_concentric_squares(number_of_squares=10, radius_increase = 7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment