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. /Transits and wobbles in code
Space Science and AstronomyMediumHigh School (9–10)The Solar System

Transits and wobbles in code

You will write three functions that turn the data of a transit or a Doppler shift into numbers about a planet system. Lengths are in km, wavelengths in nm and speeds in m/s.

The idea. The dip of a transit is (Rp/Rs)2(R_p/R_s)^2(Rp​/Rs​)2. A Doppler shift gives v=c Δλ/λv = c\,\Delta\lambda/\lambdav=cΔλ/λ with c=2.998×108 m/sc = 2.998 \times 10^8\ \text{m/s}c=2.998×108 m/s. The inner edge of the habitable zone is about 0.95L AU0.95\sqrt{L}\ \text{AU}0.95L​ AU.

Your tasks.

  1. In transit_depth, return the share of the star's light that is blocked, as a fraction.
  2. In star_speed, return the speed of the star in m/s from the shift and the wavelength, both in nm.
  3. In habitable_inner, return the inner edge of the habitable zone, in AU, for a star of luminosity lum.

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 depth for a planet of radius 12 000 km12\,000\ \text{km}12000 km round a star of radius 400 000 km400\,000\ \text{km}400000 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
← Temperatures and ages in codeA telescope calculator →
More onThe Solar System

Discussion (0)

Log in to join the discussion.

Loading…

More labs on this topic

  1. Temperatures and ages in codeEasy
  2. Orbits and radio signals in codeMedium
  3. Planet data in codeEasy
  4. Estimates and uncertainty in codeMedium
  5. Magnitudes in codeMedium
All labs on this topic →