Julio Cesar Chavez Mark VII is an interplanetary space boxer, who currently holds the championship belts for various weight categories on many different planets within our solar system. However, it is often difficult for him to recall what his "target weight" needs to be on earth in order to make the weight class on other planets. Write a program to help him keep track of this
# Surface gravity of various bodies of the solar system taken from wikipedia
# general data for VARIANT 1 and VARIANT 2
planet_dict_g = {'Mercury': 0.377,
'Venus': 0.905,
'Mars': 0.379,
'Jupiter': 2.528,
'Saturn': 1.065,
'Uranium': 0.886,
'Neptune': 1.137,
'Pluto': 0.063,
'Moon': 0.165,
'Sun': 28.02}
# VARIANT 1
# If the weight needs to be shown only for the selected planet
weight_earth = float(input('What is your weight on Earth?(only number in kg) '))
print('Which planet are you visiting?')
planet = input('(Mercury, Venus, Mars, Jupiter, Saturn, Uranium, Neptune, Pluto, Moon, Sun):').capitalize()
if planet_dict_g.get(planet):
print(f'Your weight on the {planet} is {round(weight_earth * planet_dict_g.get(planet), 2)} kg')
else:
print(f'Wrong name of planet')
# end VARIANT 1
# VARIANT 2
# If the weight needs to be shown for all planets
weight_earth = float(input('What is your weight on Earth?(only number in kg) '))
for key in planet_dict_g:
print(f'Your weight on the {key} is {round(weight_earth * planet_dict_g[key], 2)} kg')
# end VARIANT 2
Variant 1 Output:
What is your weight on Earth?(only number in kg) 50
Which planet are you visiting?
(Mercury, Venus, Mars, Jupiter, Saturn, Uranium, Neptune, Pluto, Moon, Sun):Jupiter
Your weight on the Jupiter is 126.4 kg
Variant 2 Output:
What is your weight on Earth?(only number in kg) 50
Your weight on the Mercury is 18.85 kg
Your weight on the Venus is 45.25 kg
Your weight on the Mars is 18.95 kg
Your weight on the Jupiter is 126.4 kg
Your weight on the Saturn is 53.25 kg
Your weight on the Uranium is 44.3 kg
Your weight on the Neptune is 56.85 kg
Your weight on the Pluto is 3.15 kg
Your weight on the Moon is 8.25 kg
Your weight on the Sun is 1401.0 kg
Comments
Leave a comment