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 :

Get Discount on Top Educational Courses

Brand NameDiscount InformationCoupon Codes Link
Educative.io20% discount on Educative courses and plans
W3Schools20% discount on W3Schools courses
KodeKloud10% discount on KodeKloud courses and plans
GeeksforGeeks30% discount on GeeksforGeeks courses
Target Test Prep20% discount on Target Test Prep
Coding Ninjas₹5000 discount on Coding Ninjas courses
Skillshare40% discount on Skillshare
DataCamp50% discount on DataCamp
365 Data Science57% discount on 365 Data Science Plans
Get SmarterFlat 20% discount on Get Smarter courses
SmartKeedaFlat 40% discount on SmartKeeda courses
StackSocial20% discount on StackSocial courses
				
					# 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

AI Virtual Painter Using Python using OpenCV with Python GUI Introduction: The way we interact with technology is being completely transformed by …

GYM Management System Using Java Introduction A Gym Management System (GMS) is a special type of software created to cater to the …

10+ Responsive Navigation Menus using HTML CSS JS Introduction Hello friends, you all are welcome to today’s new blog post. Today we …

Hotel Reservation System using java Introduction This project was developed in Java and has a JavaFX Graphical User Interface (GUI) which provides …

Bank management system using java with Swing(GUI) Introduction In the modern digital world, managing your banking operations efficiently is critical. This Java-based …

Hospital Management System using java Swing GUI Introduction   The health care industry needs efficient and flexible management systems to process a  large …