from numpy import random import math iterations = 200 samples = 1000 def M(x,y): z = x+y*1j k = 0 while abs(z)<2 and k