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. /Months and orbital speed in code
Space Science and AstronomyMediumHigh School (9–10)The Moon

Months and orbital speed in code

You will write three functions about the Moon's months and its motion.

The idea. The synodic month SSS follows from 1/S=1/P−1/E1/S = 1/P - 1/E1/S=1/P−1/E. A body that goes once round in PPP days moves 360∘/P360^\circ/P360∘/P each day. The average orbital speed is v=2πr/Tv = 2\pi r/Tv=2πr/T; with rrr in km and TTT in days, divide by 86 40086\,40086400 to get km/s.

Your tasks.

  1. In synodic, return the synodic period from the sidereal period and the year.
  2. In degrees_per_day, return how far a body moves each day.
  3. In orbit_speed, return the speed in km/s.

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, find the synodic month as seen from Mars, if Mars had a moon that went round it in 27.32227.32227.322 days. The year of Mars is 687687687 days.

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
← Moon phases in codeCrater counts in code →
More onThe Moon

Discussion (0)

Log in to join the discussion.

Loading…

More labs on this topic

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