Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # t_Sierpinski_Triangle.py
- import turtle
- Window = turtle.Screen()
- Window.bgcolor('white')
- turtle.color('white')
- def serp_tri(side):
- turtle.goto(-side/2, -side/2.3)
- side = side*1.0
- def triangle(side):
- if side > 3:
- for i in range(3):
- turtle.color('black')
- turtle.ht()
- turtle.fd(side)
- turtle.left(120)
- turtle.pu()
- if int(side) < 10:
- turtle.pd()
- turtle.ht()
- triangle(side/2)
- turtle.fd(side/2)
- triangle(side/2)
- turtle.bk(side/2)
- turtle.left(60)
- turtle.fd(side/2)
- turtle.right(60)
- triangle(side/2)
- turtle.left(60)
- turtle.bk(side/2)
- turtle.right(60)
- turtle.speed(0)
- triangle(side)
- serp_tri(600)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement