exercise 5.3. fermat’s last theorem says there no positive integers a, b, , c such that
a^n + b^n = c^n
for values of n greater 2.
- write function named check_fermat takes 4 parameters—a, b, c , n—and checks see if fermat’s theorem holds. if n greater 2 , turns out true that
a^n + b^n = c^n
the program should print, “holy smokes, fermat wrong!” otherwise program should print, “no, doesn’t work.”
- write function prompts user input values a, b, c , n, converts them integers, , uses check_fermat check whether violate fermat’s theorem.
def check_fermat(a, b, c, n): if n > 2 , (a**n + b**n == c**n): print("holy smokes, fermat wrong!") else: print("no, doesn’t work.") def check_numbers(): = int(input("choose number a: ")) b = int(input("choose number b: ")) c = int(input("choose number c: ")) n = int(input("choose number n: ")) return check_fermat(a, b, c, n) check_numbers() probably return "no, doesn't work" ....
Comments
Post a Comment