How to make a rainbow drawing using python Turtle

 Hello Everyone, 

In this blog I will show you how to create a rainbow drawing using python turtle

It's very easy 

Code:

# Python turtle Programming
#First if this code show an error just type in terminal (pip install turtle)
import turtle
colors = ['red', 'purple', 'blue', 'green', 'orange', 'yellow']
t = turtle.Pen()
turtle.bgcolor('black')
for x in range(360):
    t.pencolor(colors[x%6])
    t.width(x//100 + 1)
    t.forward(x)
    t.left(59)

Output:



Comments

Post a Comment

Popular posts from this blog

How To Make a Hack of Create Many Files Using python