Your 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:
For this challenge, we will write a short Python program, based on the Input / Process / Output model. Our program will:
Ask the user to input their weight in kg and store this value in a variable called weightOnEarth.
Apply the formula to calculate the equivalent lunar weight and store it in a variable called weightOnMoon.
Display the weight on the Moon on screen.
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)|