import turtle as t def sierpinski(cote, n) : for _ in range(3) : if n > 0 : sierpinski(cote/2, n-1) t.forward(cote) t.left(120) t.hideturtle() # on cache la tortue t.speed(0) # tortue rapide sierpinski( 400 , 5) t.mainloop()
Create, edit, and import your Python scripts
import turtle as t def sierpinski(cote, n) : for _ in range(3) : if n > 0 : sierpinski(cote/2, n-1) t.forward(cote) t.left(120) t.hideturtle() # on cache la tortue t.speed(0) # tortue rapide sierpinski( 400 , 5) t.mainloop()