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.
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 min. Which expression gives its growth rate per minute, for ?
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 is very small compared with ?
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 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?
Each one has a hint, the key idea and a full worked solution.