Print Rainbow Benzene using python

In this tutorial, we are going to see How to Print Rainbow Benzene using python. We have also added the video tutorial and the source code for the program.

So let us start with How to Print Rainbow Benzene using python.

 

Video Tutorial: Print Rainbow Benzene using python

 

 

Source Code:

 

# Python program to draw
# Rainbow Benzene
import turtle
screen = turtle.Screen()
screen.setup(500, 600, startx=0, starty=100)
colors = ['red', 'purple', 'blue', 'green', 'orange','yellow']
t = turtle.Pen()
turtle.bgcolor('black')
for x in range(280):
    t. pencolor(colors [x%6])
    t.width(x//100 + 1)
    t. forward(x)
    t. left(59)

 

Output:

 

Leave a Reply

Your email address will not be published. Required fields are marked *