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 Programming
  2. /Python for Science and Maths
  3. /Biology by Computer

Biology by Computer

Python Programming · High School (11–12) · 2 courses, 21 worked problems, 40 practice questions

Biology has many patterns that a program can model. A population that grows by a fixed fraction each day grows exponentially, and a short loop can step it forward in time. When food or space runs out, growth slows and levels off at the carrying capacity. This is logistic growth. Python can fit such curves to real counts and find a doubling time. In genetics, a function can build a Punnett square and predict the ratios of a cross. A simulation of many offspring shows how close real counts come to those ratios.

With practice you will be able to

  • Model exponential and logistic growth with a loop
  • Find a doubling time from a growth rate
  • Build a Punnett square in code and predict a cross

Lessons

  • Growth and Populations by ComputerWhy can no population keep doubling for ever? How do you read growth from scattered counts?High School (11–12)
  • Genetics by ComputerWhy do pea crosses give 3 tall to 1 short? Why do small samples miss that ratio?High School (11–12)

Practice questions

Choose an answer, then check it. Each one shows a full explanation.

A loop follows a culture of Amoeba through four divisions. What does it print? N = 70; for i in range(4):; N = 2 * N; print(N)

A culture of 160 cells doubles every 35 min. What does this print? print(160 * 2 ** (105 / 35))

A culture doubles every 353535 min. Which expression gives its growth rate rrr per minute, for N=N0ertN = N_0 e^{rt}N=N0​ert?

Counts that grow exponentially are plotted with plt.yscale("log"). What shape do they make?

Counting times for a growth experiment, in minutes. What does this print? import numpy as np; t = np.arange(0, 61, 15); print(len(t), t[-1])

In logistic growth, how does the population grow while NNN is very small compared with KKK?

One logistic step for a pond of algae. What does it print? r, K, N, dt = 0.25, 1500, 375, 2; N = N + r * N * (1 - N / K) * dt; print(N)

Yeast in a brewing vat stops multiplying once it holds 150015001500 cells. How many cells does the vat hold when the count rises most quickly?

A fit to three counts. What does it print? import numpy as np; t = np.array([0, 10, 20]); N = np.array([90, 180, 360]); slope, c = np.polyfit(t, np.log(N), 1); print(round(np.log(2) / slope, 1))

What does curve_fit(model, t, N, p0=[0.25, 950]) return first?

All 40 practice questions on Biology by Computer →

Worked problems

Each one has a hint, the key idea and a full worked solution.

  • In a culture kept by Meera's class, each Paramecium divides by binary fission about every 8 hours…Easy
  • A strain of bacteria grows as N = N₀ eʳᵗ with r = 1.8 per hour…Easy
  • A culture starts with 400 cells and doubles every 25 minutes…Medium
  • Aditi plots ln N against t in minutes for a culture with a doubling time of 40 min…Medium
  • A population of algae in a tank grows logistically from 20 cells, with r = 0.4 per hour and a…Medium
  • Sanjay steps a logistic population with r = 0.8 per hour, K = 300 cells and N₀ = 5 cells, for 12…Medium
  • Counts of a yeast culture every hour are 50, 100, 195, 360, 560, 700 and 760 cells…Easy
  • A culture has 3000 cells at 10:00 and 48 000 cells at 12:00…Easy
  • Ritu fits a straight line to her counts with slope, intercept = np.polyfit(t, np.log(N), 1), with t…Medium
  • Duckweed spreads over a village pond. Nisha counts the fronds every 3 days: Fit a logistic curve…Hard
  • Sana has a tall pea plant and does not know if it is TT or Tt…Easy
  • Ravi's program joins the gametes with a + b but forgets to sort them…Easy

All 21 worked problems on Biology by Computer →

Python labs

  • A population stepper
  • Fitting growth curves
  • A Punnett square function
  • Simulating many crosses

Related topics

  • Python for Science and Maths
  • NumPy Arrays
  • Graphs with matplotlib
  • Solving Equations
  • Calculus by Computer
  • Simulation and Randomness
  • Data Analysis with pandas
  • Chemistry by Computer
  • Trigonometry and Waves by Computer