Created
January 17, 2018 23:15
-
-
Save ysnerdem/c68ed162a6c490c53027ef17a95288a4 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
def sqr(num): | |
if (type(num) != int): | |
raise ValueError("Geçerli bir sayı girmediniz.") | |
else: | |
return num**2 | |
try: | |
print(sqr(2)) | |
print(sqr("a")) | |
except ValueError: | |
print("Fonksiyona geçersiz değer girildi.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment