Print Rainbow Benzene using python with Source Code

In this article we will see how to draw a rainbow Benzene using Python turtle graphics. python have a turtle module. turtle is a popular way for introducing programming to kids. 

Print Rainbow Benzene using python 

To install the turtle module open your terminal and run the command below 

$ python -m pip install turtle

Source Code :

				
					# Importing the Required Module
# pip install turtle
import turtle

# Create window to Display raintbow Benzene
window = turtle.Screen()

# Setting Geomentry for the window
window.setup(600, 600, startx=0, starty=100)

# Colours
colors = ['red', 'purple', 'blue', 'green', 'orange','yellow']

# To draw the rainbow Benzene
t = turtle.Pen()
turtle.bgcolor('black')
for x in range(280):
    t. pencolor(colors [x%6])
    t.width(x//90 + 1)
    t. forward(x)
				
			

Output :

Find More Projects

Build a Quiz Game Using HTML CSS and JavaScript Introduction Hello coders, you might have played various games, but were you aware …

Emoji Catcher Game Using HTML CSS and JavaScript Introduction Hello Coders, Welcome to another new blog. In this article we’ve made a …

Typing Challenge Using HTML CSS and JavaScript Introduction Hello friends, all you developer friends are welcome to our new project. If you …

Breakout Game Using HTML CSS and JavaScript With Source Code Introduction Hello friends, welcome to today’s new blog post. All of you …

Digital and Analog Clock using HTML CSS and JavaScript Introduction : This project is a digital clock and stopwatch system, which allows …

Coffee Shop Website using HTML, CSS & JavaScript Introduction : This project is a website for coffee house business. It uses HTML …

Download 1000+ Coding Projects Code