Advertisement
johnpentyrch

ass 2.1

Apr 29th, 2020
586
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. from turtle import Turtle
  2.  
  3. tut=Turtle()
  4. tut.getscreen().bgcolor('#cccccc')
  5. tut.speed(3)
  6.  
  7. def draw_poly(t,x,y,sides,length,c,bg):
  8.     t.pensize(5)
  9.     t.penup()
  10.     t.goto(x,y)
  11.     t.color(c,bg)
  12.     t.setheading(0)
  13.     t.begin_fill()
  14.     t.pendown()
  15.     angle=360//sides
  16.     for i in range(sides):
  17.         t.forward(length)
  18.         t.left(angle)
  19.     t.end_fill()
  20.     tut.hideturtle()
  21.  
  22. draw_poly(tut,0,0,3,100,'black','red')
  23. draw_poly(tut,300,0,5,100,'black','yellow')
  24. draw_poly(tut,-300,0,7,100,'black','blue')
  25. draw_poly(tut,0,200,9,50,'black','white')
  26. draw_poly(tut,0,-200,4,50,'black','green')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement