A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
15
Task/Mandelbrot-set/Python/mandelbrot-set.py
Normal file
15
Task/Mandelbrot-set/Python/mandelbrot-set.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Python 3.0+ and 2.5+
|
||||
try:
|
||||
from functools import reduce
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
def mandelbrot(a): return reduce(lambda z, _: z*z + a, range(50), 0)
|
||||
def step(start, step, iterations): return (start + (i * step) for i in range(iterations))
|
||||
|
||||
rows = (('*' if abs(mandelbrot(complex(x, y))) < 2 else ' '
|
||||
for x in step(-2.0, .0315, 80))
|
||||
for y in step(1, -.05, 41))
|
||||
|
||||
print( '\n'.join(''.join(row) for row in rows) )
|
||||
Loading…
Add table
Add a link
Reference in a new issue