Checkpoint 17.6.1.
What shape would the following code draw?
def mystery(turtle,size):
turtle.forward(size)
turtle.right(90)
turtle.forward(size / 2)
turtle.right(90)
turtle.forward(size)
turtle.right(90)
turtle.forward(size / 2)
turtle.right(90)
from turtle import * # use the turtle library
grace = Turtle() # create a turtle named grace
mystery(grace, 100) # draw something with size = 100
- square
- Check the 2nd and 4th forwards. How much do they move forward by?
- rectangle
- This will draw a rectangle with two sides with the specified size and two sides half that size. Copy this code into the area above and run it.
- triangle
- A triangle has 3 sides.