Skip to content

Instantly share code, notes, and snippets.

@minte9
Last active July 19, 2021 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save minte9/5852f64fc6313af446df83d7da822a7e to your computer and use it in GitHub Desktop.
Save minte9/5852f64fc6313af446df83d7da822a7e to your computer and use it in GitHub Desktop.
"""
Write a function called square() that ...
takes a parameter named t, which is a turtle.
It should use the turtle to draw a square.
import turtle
bob = turtle.Turtle()
square(bob)
turtle.mainloop() """
# SOLUTION
def square(t):
for i in range(4):
t.fd(100)
t.lt(90)
import turtle
bob = turtle.Turtle()
square(bob)
square(bob)
turtle.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment