This website requires JavaScript.
Explore
Help
Sign In
mirrors
/
micropython
mirror of
https://github.com/micropython/micropython.git
Watch
1
Star
0
Fork
You've already forked micropython
0
Code
Issues
Packages
Projects
Releases
Wiki
Activity
0c7354afaf
micropython
/
tests
/
basics
/
int_divzero.py
10 lines
146 B
Python
Raw
Normal View
History
Unescape
Escape
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 00:20:00 +01:00
try
:
1
/
/
0
except
ZeroDivisionError
:
print
(
"
ZeroDivisionError
"
)
py: Catch all cases of integer (big and small) division by zero.
2015-10-01 22:48:48 +01:00
try
:
1
%
0
except
ZeroDivisionError
:
print
(
"
ZeroDivisionError
"
)