Compare commits
1 Commits
7202fef78a
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 5c13e24abf |
10
error_handling.py
Normal file
10
error_handling.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
def spam(divide_by):
|
||||||
|
try:
|
||||||
|
return 42 / divide_by
|
||||||
|
except ZeroDivisionError:
|
||||||
|
print('Error: Invalid argument.')
|
||||||
|
|
||||||
|
print(spam(2))
|
||||||
|
print(spam(1))
|
||||||
|
print(spam(42))
|
||||||
|
print(spam(0))
|
||||||
Reference in New Issue
Block a user