py: Fix up number operations and coercion.

This commit is contained in:
Damien George
2014-01-06 22:13:00 +00:00
parent 8137b004b0
commit e2e3d11e87
6 changed files with 129 additions and 98 deletions

14
examples/mandel.py Normal file
View File

@@ -0,0 +1,14 @@
@micropython.native
def in_set(c):
z = 0
for i in range(40):
z = z*z + c
if abs(z) > 60:
return False
return True
for v in range(31):
line = []
for u in range(91):
line.append('*' if in_set((u / 30 - 2) + (v / 15 - 1) * 1j) else ' ')
print(''.join(line))