In: Computer Science
Problem: Write a program that takes your weight in pounds as input and then prints how much you will weigh on Moon and Mars. The formula to convert weight on the Earth to weight on Moon and Mars are given below:
You should name the program as weight_watcher.py. The output should look like as shown below:
'''
Python version : 3.6
Python program that takes your weight in pounds as input
and then prints how much you will weigh on Moon and Mars.
'''
# input the weight in pounds on Earth
earth_weight = float(input('Enter the weight (in pounds) on Earth:
'))
# calculate the weight on Moon
moon_weight = earth_weight*0.165
# calculate the weight on Mars
mars_weight = (earth_weight*3.711)/9.81
# display the weights on Earth, Mars and Moon
print('Weight on Earth: %.2f pounds' %(earth_weight))
print('Weight on Moon: %.2f pounds' %(moon_weight))
print('Weight on Mars: %.2f pounds' %(mars_weight))
#end of program
Code Screenshot:
Output: