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. /Coasts, rain and fairness in code
Earth and Environmental ScienceMediumHigh School (9–10)Climate and Climate Change

Coasts, rain and fairness in code

You will write three functions for the ideas of the last lesson: how far the sea reaches, how much rain a roof collects, and the emissions for each person.

The idea. On land that rises 1 m1\ \text{m}1 m in every n mn\ \text{m}n m, a rise of hhh metres reaches h×nh \times nh×n metres inland. A roof of area AAA in a place with rain RRR mm collects A×R×0.8A \times R \times 0.8A×R×0.8 litres. Emissions for each person in tonnes are Gt×1000/millions of people\text{Gt} \times 1000 / \text{millions of people}Gt×1000/millions of people.

Your tasks.

  1. In flood_distance, return the distance in m that a rise rise reaches on a slope of 1 in n.
  2. In harvest, return the litres collected by a roof of roof square metres in a year with rain mm.
  3. In per_person, return the tonnes for each person from gt Gt and millions million people.

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 how far a rise of 1.2 m1.2\ \text{m}1.2 m reaches on a slope of 1 in 250025002500.

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
← A carbon footprint in codeBuildings, soil and resonance in code →
More onClimate and Climate Change

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. Living with change: adaptation and fairnessImpacts, Mitigation and Adaptation

More labs on this topic

  1. A carbon footprint in codeEasy
  2. Ice, water and the sea level in codeMedium
  3. The carbon dioxide record in codeEasy
  4. The Earth's energy balance in codeMedium
Mountain temperatures and sunlight in codeEasy
All labs on this topic →