circuitpython/tests/basics/float1.py
Paul Sokolovsky 6ded55a61f py: Properly implement divide-by-zero handling.
"1/0" is sacred idiom, the shortest way to break program execution
(sys.exit() is too long).
2014-03-31 02:23:57 +03:00

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")