Last active
July 19, 2021 12:19
-
-
Save minte9/5852f64fc6313af446df83d7da822a7e to your computer and use it in GitHub Desktop.
Python / Language / Square - https://www.minte9.com/python/language-loops-1250
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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