Editor

Filter the Hot Days

Intermediate · Write the code · from NumPy Operations: Element-wise Math, Aggregations, and ufuncs

From the lesson: NumPy Operations: Element-wise Math, Aggregations, and ufuncs

You know how to create NumPy arrays. Now it's time to actually do things with them. The real power of NumPy is that you can perform math on entire arrays at once - no loops required.

Read the lesson

Given temps = np.array([58, 67, 72, 81, 90, 85, 63, 77, 94, 71]), print:

1. All temperatures above 80

2. The count of temperatures between 65 and 80 (inclusive)

import numpy as np
temps = np.array([58, 67, 72, 81, 90, 85, 63, 77, 94, 71])
# Print temps above 80
# Print count of temps between 65 and 80

More NumPy Operations exercises

All Python exercises · 50 practice problems · Data Science & Machine Learning quiz