Loading design...

A beautiful barnsley fern fractal created with Python Turtle. Read the code below, copy it, and try it in your own Python environment.
from turtle import *
from random import random
tracer(50)
bgcolor('black')
hideturtle()
color('#43ff26')
x, y = 0, 0
for _ in range(9000):
r = random()
if r < 0.01:
x, y = 0, 0.16 * y
elif r < 0.86:
x, y = 0.85*x + 0.04*y , -0.04*x + 0.85*y + 1.6
elif r < 0.93:
x, y = 0.2*x - 0.26*y , 0.23*x + 0.22*y + 1.6
else:
x, y = -0.15*x + 0.28*y , 0.26*x + 0.24*y + 0.44
up()
goto(x*50 , y*50 - 250)
dot(3)
done()