from turtle import *
speed(0) # set penspeed
left(90) # start position
def triangle(size, order):
if order == 0:
return
for i in range(3):
forward(size)
triangle(size/2, order - 1) # recursive function
backward(size)
left(120)
triangle(100, 5) # test sierpinski triangle
done()