Computer Science, asked by aarav1303, 20 hours ago

Hello all the programmers !

Let's have something creative. Create a pattern of Indian Tri Colour Flag using graphic library.

There is no restriction of languages you are using.

#IndependenceDay​

Answers

Answered by Anonymous
5

I am using turtle module of python here

Required program :-

import turtle

t = turtle.Turtle()

t.pensize(4)

def box(color):

‎ ‎ ‎t.begin_fill()

‎ ‎ ‎t.fillcolor(color)

‎ ‎ ‎for i in range(2):

‎ ‎ ‎ ‎ ‎ ‎t.fd(400)

‎ ‎ ‎ ‎ ‎ ‎t.rt(90)

‎ ‎ ‎ ‎ ‎ ‎t.fd(80)

‎ ‎ ‎ ‎ ‎ ‎t.rt(90)

‎ ‎ ‎t.end_fill()

t.up()

t.goto(-200, -300)

t.down()

t.lt(90)

t.fd(600)

t.rt(90)

box("#FF9933")

t.rt(90)

t.fd(80)

t.lt(90)

t.fd(200)

t. color("#000088")

t.circle(-40)

t.setheading(270)

t.fd(40)

t.setheading(0)

for i in range(24):

‎ ‎ ‎t.fd(40)

‎ ‎ ‎t.bk(40)

‎ ‎ ‎t.lt(15)

t.setheading(90)

t.fd(40)

t.setheading(0)

t. color("black")

t.fd(200)

t.rt(90)

t.fd(80)

t.rt(90)

t.fd(400)

t.setheading(0)

box("#128807")

turtle.mainloop()

Refer to the attachment for output

Attachments:
Similar questions