← Back to challenges

Let's Meet!

PythonHardalgebranumbers

Instructions

From point A, an object is moving towards point B at constant velocity va (in km/hr). From point B, another object is moving towards point A at constant velocity vb (in km/hr). Knowing this and the distance between point A and B (in km), write a function that returns how much time passes until both objects meet.

Format the output like this:

"2h 23min 34s"

Examples

lets_meet(100, 10, 30) ➞ "2h 30min 0s"

lets_meet(280, 70, 80) ➞ "1h 52min 0s"

lets_meet(90, 75, 65) ➞ "0h 38min 34s"

Notes

Seconds should be rounded down to the nearest whole number.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.