Instantly share code, notes, and snippets.

Embed
What would you like to do?
Think Python, Excersie 5.2
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