29.3k views
2 votes
how to write code using python3 to input two positive values of type float representing the height and the length of the hypotenuse of a right-angled triangle and calculate and display the width of the triangle, and also the two interior angles, expressed in degrees

1 Answer

4 votes
hypot = float( input( "How long is the hypotenuse?: " ) )
height= float( input( "What's the height?: " ) )
print( "The width is %f\\" % ( sqrt( hypot**2 - height**2 ) ) )
# I don't know how to calculate interior angles, but that shouldn't be too hard
# You'll probably need to import the math lib: import math

User Swapnil Luktuke
by
7.0k points