Skip to content

Instantly share code, notes, and snippets.

@thr0wn
thr0wn / mandelbrot.py
Last active April 3, 2023 12:47
Mandelbrot set generated using python turtle
import turtle
import math
def mandelbrot(z , c , n=20):
if abs(z) > 10 ** 12:
return float("nan")
elif n > 0:
return mandelbrot(z ** 2 + c, c, n - 1)
else:
return z ** 2 + c