Answer:
In Python:
def Pythagorean_triple(hyp,side1,side2):
if hyp**2 == side1**2 + side2*2:
return True
else:
return False
print("Hypotenuse\tSide 1\t Side 2\t Return Value")
for i in range(1,501):
for j in range(1,501):
for k in range(1,501):
print(str(i)+"\t"+str(j)+"\t"+str(k)+"\t"+str(Pythagorean_triple(i,j,k)))
Step-by-step explanation:
This defines the function
def Pythagorean_triple(hyp,side1,side2):
This checks for pythagorean triple
if hyp**2 == side1**2 + side2*2:
Returns True, if true
return True
else:
Returns False, if otherwise
return False
The main method begins
This prints the header
print("Hypotenuse\tSide 1\t Side 2\t Return Value")
The following is a triple-nested loop [Each of the loop is from 1 to 500]
for i in range(1,501): -->The hypotenuse
for j in range(1,501): -->Side 1
for k in range(1,501):-->Side 2
This calls the function and prints the required output i.e. the sides of the triangle and True or False
print(str(i)+"\t"+str(j)+"\t"+str(k)+"\t"+str(Pythagorean_triple(i,j,k)))