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. /Sunspots and the Sun's turning in code
Space Science and AstronomyMediumHigh School (9–10)The Sun

Sunspots and the Sun's turning in code

You will write three functions that turn a sunspot count or two drawings into numbers about the Sun. Angles are in degrees.

The idea. The sunspot number is R=10g+sR = 10g + sR=10g+s. A spot on the equator at x/Rx/Rx/R of the radius from the middle is at a longitude sin⁡−1(x/R)\sin^{-1}(x/R)sin−1(x/R). If it moves from x1x_1x1​ to x2x_2x2​ in ttt days, the Sun turns once in 360×t/Δλ360 \times t/\Delta\lambda360×t/Δλ days.

Your tasks.

  1. In sunspot_number, return 10g+s10g + s10g+s.
  2. In longitude, return the longitude in degrees for a position x between −1-1−1 and 111.
  3. In rotation_period, return the days for one turn, from two positions and the days between them.

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 period from a spot at −0.40-0.40−0.40 and later at +0.70+0.70+0.70, with 5.05.05.0 days between.

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
← The Sun's numbers in codePlanet data in code →
More onThe Sun

Discussion (0)

Log in to join the discussion.

Loading…

More labs on this topic

  1. The Sun's numbers in codeEasy
All labs on this topic →