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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
```
```import turtle
import math

def moveTurtle(t,x,y):
"Move turtle t to location absolute location x,y with the pen up, point east"
t.up()
t.goto(x,y)
t.down()

def moveRelative(t,x,y,d):
"Move to a point relative to this point, and then set direction d"
t.up()
t.goto(t.pos()[0]+x,t.pos()[1]+y)
t.down()
t.seth(d)

def writeText(t,message,x,y):
"Write message using turtle t at (x,y)"
moveTurtle(t,x,y)
t.write(message)

def drawTriangle(t,size,color):
"Draw a triangle with turtle with sides size long"
i=0
t.pencolor(color)
while i<3:      # repeat four times
t.forward(size)
t.left(120)
i+=1

def drawSquare(t,size):
"Draw a square with turtle with sides size long"
i=0
while i<4:      # repeat four times
t.forward(size)
t.left(90)
i+=1

def drawScalableShape(t,size):
#Save start Position
sPos=t.pos()
#Draw concentric triangles each 10% smaller
#Move inward a bit each time
drawTriangle(t,size,"green")
moveRelative(t,size*.05,size*.025,0)
drawTriangle(t,size*.9,"red")
moveRelative(t,size*.05,size*.025,0)
drawTriangle(t,size*.8,"blue")
moveRelative(t,size*.05,size*.025,0)
drawTriangle(t,size*.7,"yellow")
moveRelative(t,size*.05,size*.025,0)
drawTriangle(t,size*.6,"purple")
moveTurtle(t,sPos[0],sPos[1])
#make a nice circle color
t.color("orange","yellow")
#Make a circle in the center with radius 1/10 of the size of the largest triangle
#move to the center of the triangle minus the radius of the circle
moveRelative(t,size/2,size/5,0)
t.begin_fill()
t.end_fill()
t.hideturtle()

alex = turtle.Turtle()
alex.speed(0)
writeText(alex,"Scalable Drawing",-200,200)
moveTurtle(alex,-200,-300)
drawScalableShape(alex,300)
moveTurtle(alex,0,0)
drawScalableShape(alex,100)
moveTurtle(alex,50,100)
drawScalableShape(alex,50)
moveTurtle(alex,-50,100)
drawScalableShape(alex,75)
moveTurtle(alex,-150,-30)
drawScalableShape(alex,150)
moveTurtle(alex,-80,120)
drawScalableShape(alex,200)```
result
console