4.1k views
5 votes
Help!! write the python code

Help!! write the python code-example-1
User Rhlee
by
4.4k points

1 Answer

5 votes

Answer:

import turtle

t = turtle.Turtle()

t.speed(0)

t.pendown()

colours = ["yellow", "blue", "red", "orange", "cyan", "pink", "green", "brown"]

for x in range(1,10):

t.pencolor(colours[x%len(colours)])

for i in range(4):

t.forward(20*x)

t.right(90)

Step-by-step explanation:

I made it such that you can add or remove as many colours as you want in the array, if there are more lines than colours it starts at the beginning again.

User Evgeny Kharitonov
by
4.1k points