Project 23: Hourly Temperature Interpolator
Scientific Computing
Current Task
Objective
Review day: reuse interpolation — day 15 — for hourly temperature instead of response time.
Task: interpolate the temperature at hour 9 from known hourly readings and print it.
index.py
from scipy.interpolate import interp1d
import numpy as np
hours = np.array([0, 6, 12, 18])
temps = np.array([60, 58, 75, 68])
f = interp1d(hours, temps)
print(f(9))
* Hint: Correct characters turn green, incorrect ones turn red.
Live Preview
🖼️
Verify your code to see the preview