** Consider the following program for the next two questions. It is supposed to compute the hypotenuse of a right triangle after the user enters the lengths of the other two sides.
a = float(input("Enter the length of the first side:"))
b = float(input("Enter the length of the second side:")).
h = sqrt(a * a + b* b)
print("The length of the hypotenuse is", h) **
Q. After adding import math to the code given above, what other change(s) are required in the code to make it fully work?
Answer =
We have to call math module in program like this:-
Correct program:-
import math a = float(input("Enter the length of the first side:")) b = float(input("Enter the length of the second side:")) h = math.sqrt(a * a + b * b) print("The length of the hypotenuse is", h)
The image you have uploaded is cutted from side and not visible.
ReplyDeleteWhich one : )
DeleteYou have to slide horizontally towards right to see full code
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )