This website requires JavaScript.
Explore
Help
Sign In
jebbatime
/
micropython
Watch
1
Star
0
Fork
You've already forked micropython
0
Code
Issues
Pull Requests
Projects
Releases
Wiki
Activity
jebbatime
micropython
/
tests
/
basics
/
int_divzero.py
10 lines
146 B
Python
Raw
Permalink
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-30 17:20:00 -06:00
try
:
1
/
/
0
except
ZeroDivisionError
:
print
(
"
ZeroDivisionError
"
)
py: Catch all cases of integer (big and small) division by zero.
2015-10-01 15:48:48 -06:00
try
:
1
%
0
except
ZeroDivisionError
:
print
(
"
ZeroDivisionError
"
)