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
Code it

Python Labs

Interactive, runnable Python. Edit the code, run it in your browser, no setup required.

+ Build a Lab
Pick a subject to see its topics1666 labs
The early universe in code New Physics
High School (11–12) · Astrophysics

You will write three functions about the hot early universe. The idea. The CMB is at 2.725 K today and its temperature is 2.725(1 + z) kelvin at redshift z. Wien's law gives the peak, λ = 2.898 × 10^-3/T metres. The c…

StemPy LabStemPy Lab
Which face of sulphuric acid? New Chemistry
High School (9–10) · Groups 15 and 16: Nitrogen and Oxygen Families

You will write two functions about sulphuric acid: one names the property a reaction shows, the other finds the alkali for a dibasic acid. The idea. A reaction that gives a salt with a metal, oxide, hydroxide, carbona…

StemPy LabStemPy Lab
Income, return and a switch New Mathematics
High School (9–10) · Commercial Mathematics

You will write the income and the return of a holding, then use them to judge a switch from one share to another. Your tasks. In income, return the number of shares times the rate of dividend (as a fraction) times the…

StemPy LabStemPy Lab
The migrant's planner New Biology
High School (11–12) · Animal Behaviour and Ethology

You will plan the fuel of a migrant, predict the error of a clock-shifted bird, and follow a clock that runs free. The idea. The fat needed is the power times the flight time, divided by 39 000 J per gram. The flight…

StemPy LabStemPy Lab
Fit a noisy sine Python Programming
High School (11–12), High School (9–10), Undergraduate, General · Trigonometry and Waves by Computer

You will fit a sine to 60 noisy readings of a swinging spring, with a first guess from the FFT. The idea. The FFT finds the main frequency to within one bar. curve_fit then refines the amplitude, the frequency and the…

StemPy LabStemPy Lab
From quarterly data to a forecast New Statistics & Data Science
High School (9–10) · Time Series

You will build the whole method for quarterly data: centred moving averages, seasonal components and a forecast. The idea. Centre the 4-point averages by taking the mean of each neighbouring pair. The first centred va…

StemPy LabStemPy Lab
From a truth table to an expression New Computer Science
High School (9–10) · Boolean Logic

You will turn an output column into a logic expression by the method of the lesson: one AND term for each row with X = 1, joined by OR. Your tasks. In term, return the AND term for one row. An input that is 1 is writt…

StemPy LabStemPy Lab
The critical density in code New Space Science and Astronomy
High School (9–10) · The Milky Way and Galaxies

You will write three small functions about the density of the Universe. The idea. The critical density is ρ_c = 3H_0^2/(8π G) with H_0 in s^-1. A value in km/s per Mpc is changed to s^-1 by dividing by 3.086 × 10^19.…

StemPy LabStemPy Lab
Terms of trade over a decade New Earth and Environmental Science
High School (11–12) · Environmental Systems and Sustainability

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 import pri…

StemPy LabStemPy Lab
Hubble's law in code New Physics
High School (11–12) · Astrophysics

You will write three functions about the expansion of the universe. Speeds are in km/s, distances in Mpc. The idea. For small redshifts v = cz, with c = 3.00 × 10^5 km/s. Hubble's law is v = H_0d. The Hubble time is 1…

StemPy LabStemPy Lab
Following the Ostwald process New Chemistry
High School (9–10) · Groups 15 and 16: Nitrogen and Oxygen Families

You will write three functions that follow the nitrogen atoms through the Ostwald process. The idea. Step 1: 4NH_3 + 5O_2 → 4NO + 6H_2O. Step 2: 2NO + O_2 → 2NO_2. Step 3: 4NO_2 + 2H_2O + O_2 → 4HNO_3. Each step keeps…

StemPy LabStemPy Lab
A shares calculator New Mathematics
High School (9–10) · Commercial Mathematics

You will write three functions about buying shares and test them on the lesson: ₹15 000 in ₹100 shares at ₹125. Your tasks. In shares_bought, return the number of whole shares the money buys. Use //. In premium, retur…

StemPy LabStemPy Lab
The forager's calculator New Biology
High School (11–12) · Animal Behaviour and Ethology

You will rank prey by profitability and find the best time to stay in a patch that runs down. The idea. Profitability is E/h. In a patch the gain after t seconds is G(1 - e^-t/k), and the rate over a trip is the gain…

StemPy LabStemPy Lab
A wave and its speed Python Programming
High School (11–12), High School (9–10), Undergraduate, General · Trigonometry and Waves by Computer

You will draw a wave of wavelength 3.0 m and frequency 4.0 Hz at two times, find its first crest each time, and work out its speed. The idea. The crest of y = A(kx - ω t) moves at the speed v = fλ. You find where the…

StemPy LabStemPy Lab
Moving averages of any length New Statistics & Data Science
High School (9–10) · Time Series

You will write a function that finds the moving averages of a time series for any number of points, and use it to see which length removes a seasonal swing. The idea. A k-point moving average is the mean of k values i…

StemPy LabStemPy Lab
A three-input truth table New Computer Science
High School (9–10) · Boolean Logic

You will code the circuit X = (A AND B) OR (NOT C) and build its truth table in the syllabus order. Your tasks. In circuit, return X for the inputs a, b and c. Set rows to the 8 input rows (a, b, c) in binary order. S…

StemPy LabStemPy Lab
The cooling afterglow in code New Space Science and Astronomy
High School (9–10) · The Milky Way and Galaxies

You will write three small functions about the microwave background. The idea. Wien's law gives the peak wavelength λ_ = 2.898 × 10^-3/T in metres. When space was S times smaller, the glow was S times hotter. The stre…

StemPy LabStemPy Lab
Ozone-depleting gases after a ban New Earth and Environmental Science
High School (11–12) · The Atmosphere and Weather

You will follow the amounts of three ozone-depleting gases in the air after their emissions stop, and find when each one falls below a target. The idea. A gas with a lifetime of τ years falls as N = N_0e^-t/τ The amou…

StemPy LabStemPy Lab
Finding exoplanets in code New Physics
High School (11–12) · Astrophysics

You will write three functions that astronomers use to find and measure planets. Masses are in solar masses, distances in AU, times in years. The idea. Kepler's third law in these units is M = a^3/T^2. A transit of de…

StemPy LabStemPy Lab
Which metal ion is it? New Chemistry
High School (9–10) · Groups 15 and 16: Nitrogen and Oxygen Families

You will write a small identifier for metal ions, using what ammonia solution does to their solutions, and a calculator for the nitrogen in a fertiliser. The idea. Ammonia solution gives a precipitate with each of the…

StemPy LabStemPy Lab
Finding the missing number New Mathematics
High School (9–10) · Commercial Mathematics

You will write two functions that read the RD formula backwards. Your tasks. In instalment, return P = (MV)/(n + (n(n + 1))/(24) × (r)/(100)). In months, start at n = 1 and add 1 while the interest is still less than…

StemPy LabStemPy Lab
The kin and flock calculator New Biology
High School (11–12) · Animal Behaviour and Ethology

You will work out the relatedness of worker bees, test Hamilton's rule, and find how safe a flock is. The idea. Two workers whose mother mated with n males have an average relatedness of 0.25 + 0.5/n. Helping is favou…

StemPy LabStemPy Lab
An identity checker Python Programming
High School (11–12), High School (9–10), Undergraduate, General · Trigonometry and Waves by Computer

You will write three small functions that check a claimed identity on many angles: one finds the worst miss between the two sides, one says whether the identity holds, and one finds an angle where it fails. The idea.…

StemPy LabStemPy Lab
Build a weighted index New Statistics & Data Science
High School (9–10) · Index Numbers

You will build a small cost of living index from what a household bought in the base year. The idea. Each weight is the base-year spending: quantity × base-year price. The index is Σ (w × price relative)Σ w. The cost…

StemPy LabStemPy Lab
Name the gate from its column New Computer Science
High School (9–10) · Boolean Logic

You will write a function that names a two-input gate from its output column, and a function that builds the 8 rows of a three-input truth table in order. Your tasks. In name_gate, return the name of the gate in GATES…

StemPy LabStemPy Lab
Page 1 of 67
…

Showing 1–25 of 1666