Fermat’s Last Theorem

snip20161218_1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

raw_input is a function that allows users to input information that were designed by the programmer. With this exercise I’ve learned to do this. Our first step is to set a, b, c, and n equal to  the setting for the user to input data,  int(input . Next we add the string to ‘What value to use (variable) : , closing it up with parentheses. Next we define the function check_fermat with the arguments of a, b, c, and n. Now we want to check if the theorem a^n + b^n = c^n. So we start with an if statement followed by a**n +b**n == c**n, when the user inputs the numbers and proves this theorem the coding will print out ‘Fermat was right!’. The else statement is placed when the user inputs numbers that doesn’t cooperate with the theorem, which will then print out ‘No that doesn’t work.’

 

Then we run the program!

 

snip20161219_16