Last active
November 7, 2017 20:54
-
-
Save sepulchered/89744afc3e67084b9074575c567504ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import typing | |
def divide(num: float, den: float) -> typing.Optional[float]: | |
try: | |
return num / den | |
except ZeroDivisionError: | |
return None | |
print(divide(1, 2)) | |
print(divide(1, 0)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment