๐ ๏ธ Section project: a spiral
Section 7: Drawing with the turtleLesson 7.3 ยท โฑ 10 min
๐ฏ Project goal
A coloured spiral: every line is longer than the one before.
import turtle
t = turtle.Turtle()
t.speed(0)
t.pensize(2)
for i in range(100):
t.color(["#5B3DF5", "#1E7BFF", "#18B37E", "#FF8A1F"][i % 4])
t.forward(i * 2)
t.left(91)
๐ Open the code in Robo Python โ๐ Another example: a square spiral
Every side is a little longer than the one before.
import turtle
t = turtle.Turtle()
t.speed(0)
t.color("blue")
for i in range(60):
t.forward(i * 4)
t.left(90)
๐ Open the code in Robo Python โ
โ๏ธ Practise
Challenge: change 91 to 89 or 121. What happens to the shape?
โ๏ธ Practise here in the lessonโ Close the labor open the lab in a new page โ
๐ฏ Challenge yourself
Easy
A spiral turning 91 instead of 90: it becomes twisted.
๐ Show the solution๐ Hide the solution
import turtle
t = turtle.Turtle()
t.speed(0)
for i in range(80):
t.forward(i * 3)
t.left(91)
๐ Open the code in Robo Python โ
Result: a twisted spiral.
Medium
A spiral of circles: 36 circles, turning 10 each time.
๐ Show the solution๐ Hide the solution
import turtle
t = turtle.Turtle()
t.speed(0)
t.color("purple")
for i in range(36):
t.circle(70)
t.left(10)
๐ Open the code in Robo Python โ
Result: a flower of circles.
Hard
A spiral with colours taking turns.
๐ Show the solution๐ Hide the solution
import turtle
t = turtle.Turtle()
t.speed(0)
colors = ["red", "orange", "green", "blue"]
for i in range(100):
t.color(colors[i % 4])
t.forward(i * 2)
t.left(91)
๐ Open the code in Robo Python โ
Result: a coloured spiral.

