mirror of
https://github.com/micropython/micropython.git
synced 2025-09-07 18:30:27 +02:00
"1/0" is sacred idiom, the shortest way to break program execution (sys.exit() is too long).
17 lines
217 B
Python
17 lines
217 B
Python
# basic float
|
|
x = 1 / 2
|
|
print(x)
|
|
|
|
print(1.0 // 2)
|
|
print(2.0 // 2)
|
|
|
|
try:
|
|
1.0 / 0
|
|
except ZeroDivisionError:
|
|
print("ZeroDivisionError")
|
|
|
|
try:
|
|
1.0 // 0
|
|
except ZeroDivisionError:
|
|
print("ZeroDivisionError")
|