Topic 3
♾️ Loops ♾️

donow()
1. Predict
2. Modify

3. Challenge

hint: tina.color("blue")




A
B
C
D
2. Modify

3. Challenge

hint: tina.color("blue")
def donow():
tina = turtle.Turtle()
tina.shape("arrow")
tina.color("teal")
tina.forward(50)
tina.penup()
tina.goto(0,50)
tina.pendown()
tina.forward(50)
tina.penup()
tina.goto(0,-50)
tina.pendown()
tina.forward(50)
donow()def donow():
tina = turtle.Turtle()
tina.shape("arrow")
tina.color("teal")
tina.forward(50)
tina.penup()
tina.goto(0,50)
tina.pendown()
tina.forward(50)
tina.penup()
tina.goto(0,-50)
tina.pendown()
tina.forward(50)
tina.color("red")
tina.goto(50,50)
tina.penup()
tina.goto(0,50)
tina.pendown()
tina.goto(0,-50)
donow()square()
for i in range(n):
makes a loop that repeats
indented instructions
exactly n times.




A
B
C
D
3. Challenge
1. Predict

2. Modify

3. Challenge

2. Modify

def square():
tina = turtle.Turtle()
tina.shape("square")
tina.color("maroon")
tina.penup()
tina.goto(-50,-50)
tina.pendown()
for i in range(4):
tina.forward(100)
tina.left(90)
square()def square():
tina = turtle.Turtle()
tina.shape("square")
tina.color("maroon")
tina.penup()
tina.goto(-50,-50)
tina.pendown()
for i in range(4):
tina.forward(100)
tina.left(90)
tina.penup()
tina.goto(-100,-100)
tina.color("purple")
tina.pendown()
for i in range(4):
tina.forward(200)
tina.left(90)
square()triangle()
for i in range(n):
makes a loop that repeats
indented instructions
exactly n times.




A
B
C
D
3. Challenge
1. Predict

2. Modify

3. Challenge

2. Modify

def triangle():
tina = turtle.Turtle()
tina.shape("classic")
# GREEN TRIANGLES
tina.color("green")
for i in range(3):
tina.forward(25)
tina.left(120)
for i in range(3):
tina.forward(50)
tina.left(120)
for i in range(3):
tina.forward(75)
tina.left(120)
# RED TRIANGLE
tina.color("red")
for i in range(3):
tina.forward(25)
tina.right(120)
for i in range(3):
tina.forward(50)
tina.right(120)
for i in range(3):
tina.forward(75)
tina.right(120)
triangle()spiral()
while True:
makes a loop that repeats
indented instructions
forever ♾️
Let's modify the code to make our first spiral like below.
side += ?



Click for Square Spiral
Click for Triangle Spiral (part 1)
Click for Triangle Spiral (part 2)
spiral()
while True:
makes a loop that repeats
indented instructions
forever ♾️
Make your own spiral by changing the side and angle values, the colors and shape.
Hint: Change the speed to tina to 0 (the max)
tina.speed(0)

Challenge
How was I able to do a reverse spiral like in the gif below?
Topic 3 - Loops
By Jakob Stanley Warth
Topic 3 - Loops
- 74