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 →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data 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. /Keeping the carbon books
BiologyEasyHigh School (9–10)Ecology and Environment › Cycles in Nature

Keeping the carbon books

You will write functions that keep the books of the carbon dioxide in the air of a model world.

The idea. The change in the air in a year is what goes in (respiration, decomposition and burning) minus what comes out (photosynthesis). A steady change repeats every year.

Your tasks.

  1. Finish net_change. It gives the change in the air in a year.
  2. Finish air_after. It gives the amount in the air after a number of years.
  3. Finish years_until. It gives the first year in which the air holds at least a limit.

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, call years_until(800, 5, 1000). How long does a rise of 5 units a year take to add 200 units?

StemPy LabContributed by StemPy Lab
python
Loading Python runtime…

A 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
← Expected mutationsThe nitrogen chain →
More onEcology and Environment › Cycles in Nature

Discussion (0)

Log in to join the discussion.

Loading…

More labs on this topic

  1. The nitrogen chainEasy
  2. A model of levelling offEasy
  3. Reading growth readingsEasy
  4. Seed viability and categoriesMedium
  5. Zones of a reserveEasy
All labs on this topic →