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. /Eclipse seasons in code
Space Science and AstronomyMediumHigh School (9–10)Seasons, Eclipses and Tides

Eclipse seasons in code

You will write three functions about the tilted orbit of the Moon and the timing of eclipses.

The idea. As the Moon goes round, its distance from the ecliptic is about β=5.14∘×sin⁡u\beta = 5.14^\circ \times \sin uβ=5.14∘×sinu, where uuu is its angle past a node. As rough rules, a solar eclipse needs the new Moon within 1.5∘1.5^\circ1.5∘ of the ecliptic, and a lunar eclipse needs the full Moon within 1.0∘1.0^\circ1.0∘. One saros is 6585.326585.326585.32 days.

Your tasks.

  1. In moon_beta, return β\betaβ in degrees for an angle u in degrees.
  2. In solar_possible, return True if a new Moon at angle u can give a solar eclipse.
  3. In next_in_series, return the date and time one saros after when.

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, loop over u from 0∘0^\circ0∘ to 180∘180^\circ180∘ and print the angles that allow a solar eclipse.

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
← Angular sizes and eclipse types in codeTidal stretch in code →
More onSeasons, Eclipses and Tides

Discussion (0)

Log in to join the discussion.

Loading…

More labs on this topic

  1. Spring and neap tides in codeEasy
  2. Tidal stretch in codeMedium
  3. Angular sizes and eclipse types in codeEasy
  4. Day length and sunrise in codeMedium
  5. The noon Sun in codeEasy
All labs on this topic →