Project 23: Temperature Averager
Data Engineer
Builds on these lessons
Current Task
Objective
A ufunc (universal function) like np.add applies an operation element-wise across whole arrays at once, in fast compiled code.
Task: use np.add on two temperature arrays, then divide by 2 to get the average, and print it.
index.py
import numpy as np
morning_temps = np.array([15, 17, 19])
afternoon_temps = np.array([22, 24, 21])
avg_temps = np.add(morning_temps, afternoon_temps) / 2
print(avg_temps)
* Hint: Correct characters turn green, incorrect ones turn red.
Live Preview
🖼️
Verify your code to see the preview