Exercises · Q21
Q.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:
a) 16 feet and 75 degrees
b) 20 feet and 0 degrees
c) 24 feet and 45 degrees
d) 24 feet and 80 degrees
Yanam CbseNCERTSubjective· 3mImportance★★★★★est
98% · 48/49 Questions
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →height = length × sin(angle), converting degrees to radians first — giving ≈ 15.45 ft, 0.0 ft, ≈ 16.97 ft and ≈ 23.64 ft for the four cases.
The geometry: the ladder, the wall and the ground form a right triangle in which the ladder is the hypotenuse and the angle is at the ground. The height reached on the wall is the side opposite the angle, so height = length × sin(angle). The programming concept is that math.sin() expects radians, so the degree inputs must go through math.radians() first.
# Height reached on the wall by a leaning ladder
import math
for length, angle in [(16, 75), (20, 0), (24, 45), (24, 80)]:
height = length * math.sin(math.radians(angle))
print(length, "feet at", angle, "degrees -> height", round(height, 2), "feet")
Key lines:
math.radians(angle)converts degrees to radians (75° → 1.3089…). Feeding degrees straight intomath.sinis the classic bug — sin(75 radians) ≈ −0.39, a nonsense height.- The loop evaluates all four required cases in one run.
Working for each case:
| Case | length | angle | sin(angle) | height = length × sin |
|---|---|---|---|---|
| a | 16 ft | 75° | 0.9659 | 15.45 ft |
| b | 20 ft | 0° | 0.0 | 0.0 ft |
| c | 24 ft | 45° | 0.7071 | 16.97 ft |
| d | 24 ft | 80° | 0.9848 | 23.64 ft |
Expected output:
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.