Print Rainbow Benzene using python

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

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

Hostel Management System Using Python With Source Code by using Python Graphical User Interface GUI Introduction: Managing a hostel efficiently can be …

Contra Game Using Python with source code using Pygame Introduction: Remember the super fun Contra game where you fight aliens and jump …

Restaurant Billing Management System Using Python with Tkinter (Graphical User Interface) Introduction: In the bustling world of restaurants, efficiency is paramount, especially …

Jungle Dash Game Using Python with source code with pygame module Introduction: Dive into the excitement of jungle adventures with our new …

Building a Tetris Game with Python with source code Introduction: Welcome to the world of Tetris, where falling blocks meet strategic maneuvers …

Super Mario Game Using Python with source code Introduction: Remember playing Super Mario as a kid? It’s that classic game where you …

All Coding Handwritten Notes

Browse Handwritten Notes