loading
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import turtle
wn = turtle.Screen()   
alex = turtle.Turtle()
scale=10

def move(t,x,y):
  "Move a turtle t to (x,y) without drawing"
  t.up()
  t.goto(x,y)
  t.down()

def square(t,x,y,size):
  "Draw a square of a given size at (x,y)"
  move(t,x,y)
  for i in range(4):      # repeat four times
    t.forward(size*scale)
    t.left(90)

def triangle(t,x,y,size):
  "Draw a triangle of a given size at (x,y)"
  move(t,x,y)
  for i in range(3):      # repeat four times
    t.forward(size*scale)
    t.left(120)

def drawPolygon(t,sides,size):
  "Draw a polygon with turtle with sides size long"
  print("draw polygon")

square(alex,0,0,10)
square(alex,25,25,5)
triangle(alex,-50,-50,20)

wn.exitonclick()
result
console