Anonymous
public python v1 · immutableimport sys# True si el complex 'c' pertany a el conjunt de Mandelbrot, False sino.def es_mandelbrot(c): z = 0 for i in range(100): z = z*z+c; return abs(z) < 4# Dibuixem de (-2, -1) a (1, 1), en un rectangle 75x50.for y in range(50): for x in range(75): if es_mandelbrot(((x/25.0)-2.0) + ((y/25.0)-1.0) * 1j): sys.stdout.write('#') else: sys.stdout.write(' ') sys.stdout.write('\n')