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
  • 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. /Finding exoplanets in code
PhysicsMediumHigh School (11–12)Astrophysics

Finding exoplanets in code

You will write three functions that astronomers use to find and measure planets. Masses are in solar masses, distances in AU, times in years.

The idea. Kepler's third law in these units is M=a3/T2M = a^3/T^2M=a3/T2. A transit of depth δ\deltaδ gives Rp=R∗δR_p = R_*\sqrt{\delta}Rp​=R∗​δ​. A planet of mass mpm_pmp​ at speed vpv_pvp​ moves its star at v∗=(mp/M∗)vpv_* = (m_p/M_*)v_pv∗​=(mp​/M∗​)vp​.

Your tasks.

  1. In total_mass, return the total mass of two bodies with separation a and period T.
  2. In planet_radius, return the planet's radius, in the same unit as R_star, for a transit of depth depth (a fraction).
  3. In star_speed, return the star's wobble speed in m/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 total mass of two stars 5.0 AU5.0\ \text{AU}5.0 AU apart with a period of 4.04.04.0 years.

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
← Main-sequence stars in codeHubble's law in code →
More onAstrophysics

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. Binary stars and the detection of exoplanetsStellar Evolution, Binary Stars and Exoplanets

More labs on this topic

  1. The early universe in codeMedium
  2. Hubble's law in codeMedium
  3. Main-sequence stars in codeMedium
  4. Stars as black bodies in codeMedium
Distances to the stars in codeMedium
All labs on this topic →