Python's Not (Just) For Unicorns

An interactive introduction to programming in Python, for human beings and whoever else

Project

Project - Moon Measurer

When you’re in space, at least two things are true:

  1. No one can hear you scream
  2. You weigh a different amount than on Earth

Your weight on different planets1 depends on the surface gravity of that planet. According to the surface gravity page on Wikipedia, the Earth has a surface gravity of 1g, while the Moon has a surface gravity of 0.1654g. This means if something weighs 100kg on the Earth, it would weigh 16.54kg on the Moon.

These facts are important because you bet your friend $20 that you’re strong enough to pick him up, all the way over your head. He never said it had to happen on Earth, though!

If your friend weighs 80kg on Earth, how much does he weigh on other planets? Once you know, you can take a quick trip into space and win twenty bucks from him.

Planet Surface Gravity
Venus 0.904g
Earth 1g
Mars 0.376g
Ceres 0.0275g
Jupiter 2.53g
Europa 0.134g
Encelaedus 0.0113g
HD 40307g 1.420g

For each planet, print the name of the planet and how much your friend weighs on that planet. Also, please use the round function to round to two decimal points. For example, if you wanted to round 3.3333 to two decimal points, you’d do round(3.3333, 2) and it would give you 3.34.

By the way, these locations were picked because of NASA’s super-cool Visions of the Future travel posters.

weight = 80
  • Hint: Use print to print out the name and the weight
  • Hint: We can print strings and numbers together without trouble if we separate with commas, e.g. print("Words words", 30, "more words")
  • Hint: Since the Moon has a surface gravity of 0.1654g and Earth has a surface gravity of 1g, we can convert from Earth weight to Moon weight by multiplying the Earth weight by 0.1654
  • Hint: round(weight * 0.1654, 2) would give us a rounded weight on the moon
  • Hint: Cutting and pasting will help save time and some effort!
  • Hint: If we want to do the calculation and display all in one line, we can do something like print("On Venus he weighs", round(weight * 0.904, 2)). If that seems too complicated, we can also save round(weight * 0.904, 2) into its own variable and have the print on another line!

[1] Planet or other body in space. Moons are cool, dwarf planets are cool, planets from far away are cool. I don’t want to hear you complaining.