In the given example, the first side
A = 3, and the second side B = 4. To calculate the hypotenuse we use Pythagoras theorem. According to Pythagoras theorem, hypotenuse2 = 32 + 42
Therefore, the hypotenuse value is
5. So, the output should be 5.
A = int(input('Enter length of first side here: '))
B = int(input('Enter length of second side here: '))
print((A**2+B**2)**(1/2))
Enter length of first side here: 3
Enter length of second side here: 4
5.0
Comments
Leave a comment