Weight Calculator on Other planets
Logic:
Calculate your weight on another planet by multiplying your weight times the relative surface gravity of the other world.
Weight on Other Planet = Weight on Earth x Multiple of Earth’s Gravity
For example, let’s calculate your weight on mercury if you weigh 158 kgs on Earth. Gravity on pluto is 0.06 times higher than on Earth.
Weight on Pluto = 81 kg x 0.06
Weight on Pluto = 4.9 kg
Algorithm :
Take weight as Input from User
Select Planet you want to calculate weight
Based on above table perform calculation
Weight on Sun is weight on earth*27.01
Weight on Mercury is weight on earth*0.38
Weight on Venus is weight on earth*0.91
Weight on Moon is weight on earth*0.166
Weight on Mars is weight on earth*0.38
Weight on Jupiter is weight on earth*2.34
Weight on Saturn is weight on earth*1.06
Weight on Uranus is weight on earth*0.92
Weight on Neptune is weight on earth*1.19
Weight on Pluto is weight on earth*0.06
Program
earth=float(input("Enter weight on earth: "))
inp=int(input(" 1:Sun \n 2:Mercury \n 3:Venus \n 4:Moon \n 5:Mars \n 6:Jupiter \n 7:Saturn \n 8:Uranus \n 9:Neptune \n 10:Pluto \n Enter planet number : "))
if inp==1:
print("Weight on Sun : ",round(earth*27.01,2))
elif inp==2:
print("Weight on Mercury : ",round(earth*0.38,2))
elif inp==3:
print("Weight on Venus : ",round(earth*0.91,2))
elif inp==4:
print("Weight on Moon : ",round(earth*0.166,2))
elif inp==5:
print("Weight on Mars : ",round(earth*0.38,2))
elif inp==6:
print("Weight on Jupiter : ",round(earth*2.34,2))
elif inp==7:
print("Weight on Saturn : ",round(earth*1.06,2))
elif inp==8:
print("Weight on Uranus : ",round(earth*0.92,2))
elif inp==9:
print("Weight on Neptune : ",round(earth*1.19,2))
elif inp==10:
print("Weight on Pluto : ",round(earth*0.06,2))
1 Comments
This comment has been removed by the author.
ReplyDeletePost a Comment