Bird
0
0

You have a list of daily temperatures: [20, 22, 19, 24, 21]. Using NumPy, how can you quickly find the average temperature?

hard📝 Application Q15 of 15
NumPy - Fundamentals
You have a list of daily temperatures: [20, 22, 19, 24, 21]. Using NumPy, how can you quickly find the average temperature?
Anp.mean([20, 22, 19, 24, 21])
Bsum([20, 22, 19, 24, 21]) / 5
Cnp.sum([20, 22, 19, 24, 21])
Dlen([20, 22, 19, 24, 21])
Step-by-Step Solution
Solution:
  1. Step 1: Identify NumPy function for average

    NumPy provides np.mean() to calculate the average of array elements.
  2. Step 2: Compare with other options

    len() counts elements; sum() / 5 calculates average manually without NumPy's dedicated function; np.sum() sums values; np.mean() finds the average quickly.
  3. Final Answer:

    np.mean([20, 22, 19, 24, 21]) -> Option A
  4. Quick Check:

    Use np.mean() for average [OK]
Quick Trick: Use np.mean() to get average quickly [OK]
Common Mistakes:
  • Using sum without dividing for average
  • Confusing sum and mean functions
  • Not using NumPy functions for array operations

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NumPy Quizzes