Sunday, December 12, 2021

Python / Turtle: Algerian Flag


Code:

from turtle import*
setup(800,400)
width = 800
height = 400

up()
goto(-width//2, height//2)
down()
color("green")
begin_fill()
for i in range(4):
    fd(width//2)
    right(90)
end_fill()

up()
goto(0, height//2)
down()
color("white")
begin_fill()
for i in range(4):
    fd(width//2)
    right(90)
end_fill()


color("red")
left(120)
up()
goto(65, 40)
down()
begin_fill()
circle(80, 300)
right(10)
circle(61, -285)
end_fill()
up()

goto(0, 10)
down()
setheading(0)
right(15)
begin_fill()
for i in range(5):
    fd(40)
    right(144)
end_fill()
hideturtle()

No comments:

Post a Comment