Today you will use Python Turtle to draw shapes.
Type and run this code:
import turtle
t = turtle.Turtle()
for i in range(4):
t.forward(100)
t.right(90)
turtle.done()Change the code so it draws a triangle.
Change the code so it draws a hexagon.
Customize your drawing by adding:
- a color
- a pen size
- a speed
Try this pattern code:
import turtle
t = turtle.Turtle()
t.speed(0)
for i in range(12):
for j in range(4):
t.forward(100)
t.right(90)
t.right(30)
turtle.done()Change the numbers and see what new designs you can make.
If you finish early, try these:
- draw an octagon
- draw a star
- make a flower pattern
- use a different color
- make the pattern bigger or smaller
- see what happens when you change the turn angle
Answer on paper or out loud:
- What does a loop do?
- What shape uses 3 sides?
- What turn angle does a hexagon use?
- What happened when you changed the numbers?