Here are the two loops:
value = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
for i in range(10):
if m[i] < max_iter:
value[i] = 255
for i in range(10):
draw.point((x[i], y), (hue[i], sat[i], value[i]))
These are two different problems, but might as well ask for both. So for the first one: Is it possible to set the values with the condition directly in a list (or tuple)? And for the second one: Is it possible to draw multiple points at once with the pillow module? I originally planned on putting all 10 points to be simultaneously drawn as a list as the first variable, which works, but I have problems to set their color value separately.
CodePudding user response:
The first one works as a comprehension, but is harder to understand for beginners.
value = [255 if m[i] < max_iter else 0 for i in range(10)]
For drawing points the loop makes the most sense.
