This website requires JavaScript.
Explore
Help
Sign In
djsundog
/
circuitpython
Watch
1
Star
0
Fork
0
You've already forked circuitpython
Code
Issues
Pull Requests
Packages
Projects
Releases
Wiki
Activity
5dc1d389d1
circuitpython
/
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-30 19:20:00 -04:00
try
:
1
/
/
0
except
ZeroDivisionError
:
print
(
"
ZeroDivisionError
"
)
py: Catch all cases of integer (big and small) division by zero.
2015-10-01 17:48:48 -04:00
try
:
1
%
0
except
ZeroDivisionError
:
print
(
"
ZeroDivisionError
"
)
Reference in New Issue
Copy Permalink