← Back to challenges

Planetary Weight Converter

PythonHardmathobjectsphysics

Instructions

In this challenge, you have to convert a weight weighed on a planet of the Solar System to the corresponding weight on another planet.

To convert the weight, you have to divide it by the gravitational force of the planet on which is weighed and multiply the result (the mass) for the gravitational force of the other planet. See the table below for a list of gravitational forces:

weight on planet_a / gravitational force of planet_a * gravitational force of planet_b

Planetm/s²
Mercury3.7
Venus8.87
Earth9.81
Mars3.711
Jupiter24.79
Saturn10.44
Uranus8.69
Neptune11.15

Given a weight weighed on planet_a, return the converted value for planet_b rounded to the nearest hundredth.

Examples

space_weights("Earth", 1, "Mars") ➞ 0.38

space_weights("Earth", 1, "Jupiter") ➞ 2.53

space_weights("Earth", 1, "Neptune") ➞ 1.14

Notes

N/A

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Return a List of Sublists