Rainbow Generator-Python Program

Source Code:

import turtle

colours=['#801ED0','#962CE4','#912CE2', '#7C21D4','#731FCF',
         '#6113C1','#4005AD','#2B049F', '#28039E','#060390',
         '#00038E','#001C9A','#0033A8', '#014AB3','#0094DE'
         ,'#00C8F9','#01E7CD','#01CE8B', '#01B750','#07B635'
         ,'#20BD26','#7CE413','#9CEE0D', '#DFFC02','#F2FB00',
         '#FEED01','#FFAF02','#FF9501', '#FE5500','#FF2404'
         ,'#FE0700', '#FF0100']
wn=turtle.Screen()

wn.bgcolor('black')
skk=turtle.Turtle()
skk.speed(0)
skk.width(1.5)
skk.hideturtle()



skk.left(90)
x=0
a=100
b=45
while x<len(colours):
    skk.color(colours[x])
    skk.penup()
    skk.setpos(b,0)
    skk.pendown()
    skk.circle(a,180,4000)
    skk.right(180)
    x=x+1
    b=b+1.5
    a=a+1.5

turtle.mainloop()

 

Output:

RainBow

 

 

By cbsepython

A complete solution for the students of class 9 to 12 having subject Information Technology (402), Computer Science (083). Explore our website for all the useful content as Topic wise notes, Solved QNA, MCQs, Projects and Quiz related to the latest syllabus.

Leave a Reply

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