Tricolor Majesty: Crafting the Indian Flag in Python - A Patriotic Tribute

codepythonic
0

Tricolor Majesty: Crafting the Indian Flag in Python - A Patriotic Tribute







Installation:

pip install turtle


source code:





import turtle

turtle.pensize(3)

turtle.pencolor('blue')

for i in range (24):

    turtle.fd(100)

    turtle.backward(100)

    turtle.rt(15)

turtle.rt(90)

turtle.fd(100)

turtle.lt(90)

turtle.pensize(5)

turtle.circle(100)



turtle.color('green')

turtle.begin_fill()

turtle.fd(400)

turtle.rt(90)

turtle.fd(200)

turtle.rt(90)

turtle.fd(800)

turtle.rt(90)

turtle.fd(200)

turtle.rt(90)

turtle.fd(400)

turtle.end_fill()



turtle.penup()

turtle.lt(90)

turtle.fd(200)

turtle.rt(90)

turtle.pendown()

turtle.color('orange')

turtle.begin_fill()

turtle.fd(400)

turtle.lt(90)

turtle.fd(200)

turtle.lt(90)

turtle.fd(800)

turtle.lt(90)

turtle.fd(200)

turtle.lt(90)

turtle.fd(400)

turtle.end_fill()



turtle.penup()

turtle.backward(400)

turtle.lt(90)

turtle.pendown()

turtle.color('red')

turtle.begin_fill()

turtle.fd(210)

turtle.lt(90)

turtle.fd(5)

turtle.lt(90)

turtle.fd(1100)

turtle.rt(90)

turtle.fd(50)

turtle.lt(90)

turtle.fd(25)

turtle.lt(90)

turtle.fd(100)

turtle.lt(90)

turtle.fd(25)

turtle.lt(90)

turtle.fd(45)

turtle.rt(90)

turtle.fd(1100)

turtle.end_fill()

turtle.done()

    

Post a Comment

0Comments

Post a Comment (0)