HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →
Live examsInternational live exams are comingTell us which exam you want first. Timed practice papers are open now.See what is coming →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Space Science and Astronomy
  • Earth and Environmental Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Python Labs
  2. /Signals to the Moon in code
Space Science and AstronomyMediumHigh School (9–10)The Moon

Signals to the Moon in code

You will write three functions about light and radio signals between the Earth and the Moon. Distances are in km and times in seconds.

The idea. Light and radio travel at c=299 792 km/sc = 299\,792\ \text{km/s}c=299792 km/s. One way takes d/cd/cd/c. An echo or a reply takes 2d/c2d/c2d/c. Turned round, an echo after a time ttt means a distance d=ct/2d = c t/2d=ct/2.

Your tasks.

  1. In one_way, return the time for a signal to cross the distance once.
  2. In round_trip, return the time for an echo.
  3. In distance_from_echo, return the distance from an echo time.

Run it first, just as it is. The checker at the end prints FAIL for each task. Then do the tasks one at a time, and run the program again after each one. A Hint appears under every check that still fails.

When every line says PASS, work out the round trip to the Moon at perigee, 363 300 km363\,300\ \text{km}363300 km, and at apogee, 405 500 km405\,500\ \text{km}405500 km.

StemPy LabContributed by StemPy Lab
python
Loading Python runtime…

A worked solution

Run your code once to unlock the worked solution.

Have you tried it?

Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.

Log in to save
← All Labs
← Crater counts in codeThe noon Sun in code →
More onThe Moon

Discussion (0)

Log in to join the discussion.

Loading…

More labs on this topic

  1. Crater counts in codeEasy
  2. Months and orbital speed in codeMedium
  3. Moon phases in codeEasy
  4. Heights of lunar peaks in codeMedium
  5. Sizes on the Moon in codeEasy
All labs on this topic →