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. /Crater counts in code
Space Science and AstronomyEasyHigh School (9–10)The Moon

Crater counts in code

You will write three functions that compare and date surfaces by their craters.

The idea. Compare surfaces by craters on each 1000 km21000\ \text{km}^21000 km2. The surface with more of them is older. A model planetary scientists use gives the craters wider than 1 km1\ \text{km}1 km on each km² of a surface TTT billion years old as N=5.44×10−14(e6.93T−1)+8.38×10−4 TN = 5.44 \times 10^{-14}(e^{6.93T} - 1) + 8.38 \times 10^{-4}\,TN=5.44×10−14(e6.93T−1)+8.38×10−4T.

Your tasks.

  1. In per_1000, return the number of craters for each 1000 km21000\ \text{km}^21000 km2.
  2. In first_is_older, return True if the first surface has more craters on each 1000 km21000\ \text{km}^21000 km2 than the second.
  3. In model_count, return NNN for an age in billions of years.

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, print the model count for ages 0.50.50.5, 1.01.01.0, 1.51.51.5 and so on up to 4.04.04.0 billion 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
← Months and orbital speed in codeSignals to the Moon 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. Months and orbital speed in codeMedium
  3. Moon phases in codeEasy
  4. Heights of lunar peaks in codeMedium
  5. Sizes on the Moon in codeEasy
All labs on this topic →