21 with open(app_json_file, "r", encoding="utf-8") as file:
22 data = json.load(file)
23
24 nb_buttons = len(data["EzFractalButtons"]) 25 for i, button in enumerate(data["EzFractalButtons"]):
26 generate_image(button["c_real"], button["c_imag"], button["max_iterations"],
27 "popular_fractal_" + str(i) + ".png")
108 z = 0
109 num_iter = 0
110 # iterate the function until the number is diverging or the max iterations is reached
111 for i in range(max_iter):112 # julia set formula
113 z = z ** 2 + c
114 if z.real ** 2 + z.imag ** 2 > 4:
71 num_iter = 0
72
73 # iterate the function until the number is diverging or the max iterations is reached
74 for i in range(max_iter): 75 # julia set formula
76 z = z ** 2 + c
77 if z.real ** 2 + z.imag ** 2 > 4:
21 with open(app_json_file, "r", encoding="utf-8") as file:
22 data = json.load(file)
23
24 nb_buttons = len(data["EzFractalButtons"]) 25 for i, button in enumerate(data["EzFractalButtons"]):
26 generate_image(button["c_real"], button["c_imag"], button["max_iterations"],
27 "popular_fractal_" + str(i) + ".png")
108 z = 0
109 num_iter = 0
110 # iterate the function until the number is diverging or the max iterations is reached
111 for i in range(max_iter):112 # julia set formula
113 z = z ** 2 + c
114 if z.real ** 2 + z.imag ** 2 > 4:
An unused variable takes up space in the code, and can lead to confusion, and it should be removed. If this variable is necessary, name the variable _
to indicate that it will be unused, or start the name with unused
or _unused
.
def update():
for i in range(10): # Usused variable `i`
time.sleep(0.01)
display_result()
def update():
for _ in range(10):
time.sleep(0.01)
display_result()