Created
February 11, 2019 10:52
-
-
Save hikenshi/5f4d39214caa0271ab155997110555f2 to your computer and use it in GitHub Desktop.
Think Python, Excersie 5.2
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 check_fermat(a,b,c,n): | |
if n < 3: | |
print("please enter n > 2!") | |
return | |
if a**n + b**n == c**n: | |
print("Holy smokes, Fermat was wrong!") | |
else: | |
print("No, that doesn't work.") | |
try: | |
a = int(input("enter a: \n")) | |
b = int(input("enter b: \n")) | |
c = int(input("enter c: \n")) | |
n = int(input("enter n, n must be greater 2: \n")) | |
except ValueError: | |
print("Please enter an interger > 2 ") | |
return | |
check_fermat(a,b,c,n) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment