How I can make my Python program faster? This program calculates the Mandelbrot set and draws it with turtle. I think the problem is in the for loop. Maybe the steps are taking too much time.
import numpy as np
import turtle
turtle.ht()
turtle.pu()
turtle.speed(0)
turtle.delay(0) turtle.colormode(255)
i= int(input("iteration = "))
g = int(input("accuracy = "))
xmin = float(input("X-min: "))
xmax = float(input("X-max: "))
ymin = float(input("Y-min: "))
ymax = float(input("Y-max: "))
cmode = int(255/i)
input("PRESS TO START")
for x in np.arange(xmin,xmax,1/g):
for y in np.arange(ymin,ymax,1/g):
c = x + y * 1j
z = 0
t = 1
for e in range(i):
z = z * z + c
if abs(z) > 3:
turtle.setx(g*c.real)
turtle.sety(g*c.imag)
turtle.dot(2,e*cmode,e*cmode,e*cmode)
t = 0
if t == 1:
turtle.setx(g*c.real)
turtle.sety(g*c.imag)
turtle.dot(2,"black")
input("Calculated!")
turtle.mainloop()