Question: How much do things weigh on the moon? Let's write a program in python to do the calculation for us . On the moon, we

How much do things weigh on the moon? Let's write a program in python to do the calculation for us. On the moon, we can calculate our weight using the acceleration due to gravity. On earth the acceleration due to gravity is 9.81ms2, while on the moon this drops to 1.62ms2. We can use this acceleration to figure out the change in weight by using the formula:
MoonWeight =EarthWeight9.81ms2**1.62ms2
Note: the units of the weight do not matter, whatever unit you put in is what you will get out.
Write a function called moon_weight that takes no parameters, but interacts with the user to produce the following output for any given weight and returns only the value as a string.
Ask the user for a string using the console (terminal)
Required prompt: 'Please enter a weight on Earth and I will tell you what it will be on the moon:'
Perform the required transformations on the user input to obtain a numeric value as in the equation
return a string that is formatted to exactly 2 decimal places in all conditions note that some python functions will truncate values when they end in a 0. Be sure to test your function adequately.
printing to the console is not the same thing as returning a value (even though it looks that way in the output examples)
Show exactly 2 decimal places in your response:
16.51 NOT 16.5122165466456
16.50 NOT 16.5
Examples of the function running should appear as follows:
1 moon_weight ()
2 Please enter a weight on Earth and I will tell you what it will be on the moon: 100
316.51
4 Moon_weight ()
5 Please enter a weight on Earth and I will tell you what 1t will be on the moon: 99.92
6,16.50
What is the purpose, parameter and return for this question?
 How much do things weigh on the moon? Let's write a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!