Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started