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 while on the moon this drops to We can use this acceleration to figure out the change in weight by using the formula:
MoonWeight
Note: the units of the weight do not matter, whatever unit you put in is what you will get out.
Write a function called moonweight 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 decimal places in all conditions note that some python functions will truncate values when they end in a 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 decimal places in your response:
NOT
NOT
Examples of the function running should appear as follows:
moonweight
Please enter a weight on Earth and I will tell you what it will be on the moon:
Moonweight
Please enter a weight on Earth and I will tell you what will be on the moon:
What is the purpose, parameter and return for this question?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
