Skip to content

Instantly share code, notes, and snippets.

@FanFnaf4
FanFnaf4 / mandelbrot.py
Last active March 1, 2021 08:20 — forked from thr0wn/mandelbrot.py
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