Presume that a ladder is put upright against a wall. Let variables length and angle store the length of the ladder and the angle that it forms with the ground as it leans against the wall. Write a Python program to compute the height reached by the ladder on the wall for the following values of length and angle:
16 feet and 75 degrees
20 feet and 0 degrees
24 feet and 45 degrees
24 feet and 80 degrees
Explanation
This question applies trigonometry concepts to calculate the height reached by a ladder leaning against a wall. The ladder forms the hypotenuse of a right triangle, and the height on the wall is calculated using the formula: height = length × sin(angle). Python's math.sin() function requires angles in radians, so math.radians() is used to convert degrees to radians before calculation.