Weight on the Moon Calculator

MoonYour weight is a measure of the amount of gravity exerted on your body by the planet Earth. On planet Earth, gravity has a value of 9.81 N/Kg (Newtons per kilogram). Because the Moon has about one-sixth of the gravity that Earth does, you would weigh less standing on it. On the Moon, gravity has a value of 1.622 N/Kg.

We can hence use the following formula to calculate your weight on the Moon:
weight-on-the-Moon-formula

For this challenge, we will write a short Python program, based on the Input / Process / Output model. Our program will:

  1. INPUT:
    Ask the user to input their weight in kg and store this value in a variable called weightOnEarth.
  2. PROCESS:
    Apply the formula to calculate the equivalent lunar weight and store it in a variable called weightOnMoon.
  3. OUTPUT:
    Display the weight on the Moon on screen.

Python Code


Your Task:


Complete the above code to calculate and output the weight of the end-user on all of the following planets:

Planet / Celestial Body Gravity (in N/Kg)
Moon 1.622
Mercury 3.7
Venus 8.87
Mars 3.711
Jupiter 24.79
Saturn 10.44
Uranus 8.69
Neptune 11.15
unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Did you like this challenge?

Click on a star to rate it!

Average rating 3.6 / 5. Vote count: 44

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!