import turtle
s = turtle.Screen()
t = turtle.Turtle()
def move_to(x,y):
t.penup()
t.goto(x,y)
t.pendown()
def draw_rectangle(a,b):
t.begin_fill()
t.forward(a)
t.left(90)
t.forward(b)
t.left(90)
t.forward(a)
t.left(90)
t.forward(b)
t.end_fill()
t.speed(10)
t.color("red")
move_to(-500,200)
draw_rectangle(10,100)
move_to(-490,250)
t.left(90)
draw_rectangle(80,10)
move_to(-410,200)
t.left(90)
draw_rectangle(10,100)
move_to(-380,200)
t.left(60)
t.color("yellow")
draw_rectangle(10,122)
move_to(-275,198)
t.left(145)
draw_rectangle(10,110)
move_to(-350,230)
t.left(335)
draw_rectangle(10,63)
move_to(-240,198)
t.left(270)
t.color("green")
draw_rectangle(100,10)
move_to(-240,288)
draw_rectangle(50,10)
move_to(-190,288)
draw_rectangle(40,10)
move_to(-190,248)
draw_rectangle(50,10)
move_to(-160,198)
t.color("violet")
draw_rectangle(100,10)
move_to(-160,288)
draw_rectangle(50,10)
move_to(-110,288)
draw_rectangle(40,10)
move_to(-110,248)
draw_rectangle(50,10)
move_to(-80,198)
t.left(320)
t.color("orange")
draw_rectangle(120,10)
move_to(-100,295)
draw_rectangle(68,10)
move_to(-500,80)
t.left(40)
t.color("blue")
draw_rectangle(100,10)
t.left(180)
move_to(-490,70)
draw_rectangle(50,10)
t.left(90)
t.fd(50)
t.right(90)
draw_rectangle(80,10)
t.left(90)
t.fd(80)
t.left(270)
draw_rectangle(50,10)
move_to(-400,80)
t.left(180)
t.color("pink")
draw_rectangle(100,10)
move_to(-220,70)
t.left(60)
t.color("brown")
draw_rectangle(100,10)
t.left(300)
move_to(-370,70)
t.right(152)
draw_rectangle(100,10)
t.left(152)
move_to(-290,10)
t.right(45)
draw_rectangle(40,10)
t.right(3)
draw_rectangle(40,10)
move_to(-200,-15)
t.left(200)
t.color("darkgreen")
draw_rectangle(10,110)
move_to(-95,-20)
t.left(145)
draw_rectangle(10,114)
move_to(-175,25)
t.left(333)
draw_rectangle(10,63)
move_to(-70,79)
t.left(90)
t.color("skyblue")
draw_rectangle(101,10)
move_to(-60,-22)
t.left(180)
draw_rectangle(80,10)
move_to(50,-22)
t.left(180)
t.color("black")
draw_rectangle(100,10)
move_to(300,150)
t.color("red")
angle=0
for i in range(20):
t.fd(50)
move_to(300,150)
angle+=18
t.left(angle)
move_to(450,150)
t.color("blue")
angle=0
for i in range(20):
t.fd(50)
angle+=18
t.left(angle)
move_to(450,150)
move_to(375,300)
t.color("green")
angle=0
for i in range(20):
t.fd(50)
angle+=18
t.left(angle)
move_to(375,300)
move_to(375,-300)
t.color("black")
angle=0
for i in range(20):
t.fd(50)
angle+=18
t.left(angle)
move_to(375,-300)
move_to(150,-150)
t.color("violet")
angle=0
for i in range(20):
t.fd(50)
angle+=18
t.left(angle)
move_to(150,-150)
move_to(450,-150)
t.color("brown")
angle=0
for i in range(20):
t.fd(50)
angle+=18
t.left(angle)
move_to(450,-150)
move_to(-200,-300)
t.color("green")
angle=0
for i in range(20):
t.fd(50)
angle+=18
t.left(angle)
move_to(-200,-300)
move_to(125,0)
t.color("yellow")
angle=0
for i in range(20):
t.fd(50)
angle+=18
t.left(angle)
move_to(125,0)
t.color("pink")
angle=0
move_to(-100,-200)
for i in range(20):
t.fd(50)
angle+=18
t.left(angle)
move_to(-100,-200)
t.color("lightgreen")
angle=0
move_to(300,0)
for i in range(20):
t.fd(50)
angle+=18
t.left(angle)
move_to(300,0)
t.color("skyblue")
angle=0
move_to(-500,-240)
for i in range(20):
t.fd(50)
angle+=18
t.left(angle)
move_to(-500,-240)
t.color("orange")
angle=0
move_to(-350,-170)
for i in range(20):
t.fd(50)
angle+=18
t.left(angle)
move_to(-350,-170)
t.color("black")
angle=0
move_to(500,20)
for i in range(20):
t.fd(50)
angle+=18
t.left(angle)
move_to(500,20)
#clcoding.com
0 Comments:
Post a Comment