Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
620 B
7
Indexable
Never
import turtle # import turtle

t = turtle.Turtle() # create turtle object

r = 20 # declare radius
y = 0 # declare y axis
t.speed(0.3) # declare speed of turtle
colors = ["red", "blue", "orange", "brown", "magenta"] # declare list of colors
# use for loop for drawing
for i in range(20):
  t.color(colors[int(i/5)]) # select color
  t.pendown() # set turtle to draw
  t.circle(r) # draw circles
  r = r + 10 # increment radius by 10
  t.penup() # set turtle to stop drawing while changing concentric circles
  y = y - 10
  t.setpos(0,y) # set new position of turtle
  t.hideturtle() # hide turtle prompt