How Long Is the Ladder?

Python for AIEasy+10 XP+10

How Long Is the Ladder?

A ladder leans against a wall. The top touches the wall at wall_height metres, and the foot stands ground_distance metres from the wall.

The ladder's length is the square root of wall_height² + ground_distance².

Write ladder_length(wall_height, ground_distance) that returns that length. Use sqrt from the math module (reach it as math.sqrt). Don't round the answer.

Examples

wall_height = 3
ground_distance = 4
returns 5.0
wall_height = 6
ground_distance = 8
returns 10.0

Hints

Solve it to unlock the solution

Once your code passes every test, a reference solution shows up here so you can compare it with yours.

solution.py
CtrlEnterto run