Skip to content

Instantly share code, notes, and snippets.

@fnielsen
Created September 9, 2013 09:04
Show Gist options
  • Save fnielsen/6493234 to your computer and use it in GitHub Desktop.
Save fnielsen/6493234 to your computer and use it in GitHub Desktop.
Example on Python control flow/structures
xs = [ float(i)/64.0 for i in range(-150, 41) ]
ys = [ float(i)/16.0 for i in range(-25,26) ]
for y in ys:
s = ''
for x in xs:
z = 0j; i = 0
while i < 10:
z = z**2 + x+y*1j
if abs(z) > 2:
break # Get out of inner loop
i += 1
if abs(z) <= 2:
s += '*'
else:
s += ' '
print(s + '|')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment