Fruitful functions

In this assignment, we created a function called “check_fermat” that takes four parameters—a, b, c and n and that is then checked to see if Fermat’s theorem holds. Only if n is greater than 2 and it turns out to be true that an + bn = cn , then the program through python would print “Fermat was right!” and if not then “No, that doesn’t work”.

Objective: Is to understand how fruitful functions work and how they are applied. You must always have a return value when solving something like this:





Correct way


Wrong way

Overall Experience: As you may notice, coding isn’t as easy as it looks. When creating this program, I had a hard time trying to input numbers. According to our directions in creating this, we had to input value numbers that would make this equation correct and would process through and then again incorrect to see the difference. The main issue seemed that I wasn’t putting the phrase “int”, in other words referring to “integers”, and the word input for each letter. Allowing the user to input any number value for each letter as shown above.