Pythagoras theorem / Else Statements (Python)
Else Statement Pythagoras theorem says: In a right-angled triangle, the square of the hypotenuse side is equal to the sum of squares of the other two sides. Write a program that takes lengths of triangle sides as inputs, and output whether our triangle is right-angled or not. If the triangle is right-angled, the program should output "Right-angled", and "Not right-angled" if it's not. Sample Input 3 4 7 Sample Output Not right-angled [Take the 3rd input (side3 variable in sample code) as the longest side, which will represent the hypotenuse if the triangle is right-angled.] ________ My solution: side1 = int(input()) side2 = int(input()) side3 = int(input()) #your code goes here side1 *= side1 side2 *= side2 side3 *= (side1 * side1) + (side2 * side2) if side3 <= (side1*side1) + (side2*side2): ย ย ย print("Right-angled") else: ย ย ย print ("Not right-angled") __________ My solution works for 2 tests, but not the other 2..