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. /Terms of trade over a decade
Earth and Environmental ScienceMediumHigh School (11–12)Environmental Systems and Sustainability

Terms of trade over a decade

You will work out the terms of trade of a country that exports coffee, year by year, and find how much more coffee it must sell to keep buying the same imports.

The idea. Terms of trade === export price index ÷\div÷ import price index ×100\times 100×100. To buy the same imports as in the base year, the exports must be 100/ToT100/\text{ToT}100/ToT times as large. The indices below are made up for practice.

Your tasks.

  1. In terms, return the list of the terms of trade, one for each year.
  2. In first_below, return the first year (counting from 1) whose terms of trade are below level, or None.
  3. In extra_exports, return the percentage by which exports must grow in a given year, compared with the base year.

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, change the last import index to 100. How much extra coffee is needed in the last year now?

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
← Ozone-depleting gases after a banNext →
More onEnvironmental Systems and Sustainability

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. Sovereignty, trade and the toxic waste tradeEnvironment Across Borders: Ozone, Trade and Aid

More labs on this topic

  1. A footprint calculatorEasy
  2. Rations for one laneEasy
  3. A tiger reserve, year by yearHard
  4. Reading a population pyramidEasy
Rain, satellites and sunshine in codeMedium
All labs on this topic →