Solution
= Solution
Use the first 10, 20, 30 and 40 entries of the already computed list in a two-by-two array of axes. Each subplot needs an index sequence starting at one and having the same length as its data:
``
import matplotlib.pyplot as plt
fig, axes = plt.subplots(2, 2, figsize=(8, 6), layout="constrained")
for ax, stop in zip(axes.flat, [10, 20, 30, 40]):
ax.plot(range(1, stop + 1), list50[:stop])
ax.set(title=f"n = {stop}", xlabel="n", ylabel="f(n)")
plt.show()
``
The panels use different vertical scales, which is why the exponential-looking growth remains visible at each range. The available values through 50 are retained in `list50`, even though the requested four panels stop at 40.
\Image[/past-exam-of-the-mathematical-and-computational-biology-course-of-the-university-of-cambridge/2024/paper-2-fibonacci.png]
{title=Fibonacci growth over four index ranges, generated directly from the closed formula}