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. /Fitting a geotherm to a borehole
Earth and Environmental ScienceHardHigh School (11–12)The Earth's Structure and Interior

Fitting a geotherm to a borehole

A borehole logged the temperature at seven depths. You will fit a straight line, turn its slope into a heat flow and find how deep a well must go to reach a given temperature.

The idea. A least-squares line T=T0+G zT = T_0 + G\,zT=T0​+Gz fits the readings. The heat flow is q=k Gq = k\,Gq=kG. The slope GGG in K/km times a conductivity in W m−1 K−1\text{W m}^{-1}\ \text{K}^{-1}W m−1 K−1 gives qqq in mW/m².

Your tasks.

  1. In fit_line, return the slope and the intercept of the least-squares line through the readings.
  2. In heat_flow, return the heat flow in mW/m² for a conductivity k in W m−1 K−1\text{W m}^{-1}\ \text{K}^{-1}W m−1 K−1.
  3. In depth_for, return the depth in km at which the fitted line reaches the temperature T.

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, ask how deep a well must go to reach 150 ∘C150\ ^\circ\text{C}150 ∘C for a power plant. Then ask what the heat flow would be if the conductivity were 2.22.22.2 in place of 2.72.72.7.

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
← Which density contrast fits the crust?The speed of a drifting continent →
More onThe Earth's Structure and Interior

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. Heat flow and the temperature of the crustHeat Flow, Geotherms and the Magnetic Field

More labs on this topic

  1. The speed of a drifting continentHard
  2. Which density contrast fits the crust?Hard
  3. Reducing a line of gravity readingsHard
  4. Reading the shadow zones from a station listHard
  • Locating an earthquake from three stationsHard
  • All labs on this topic →