How many values in [1, 2, 3, 4, 5, 6] are even? A comparison returns True and False. Summing that mask counts the Trues. Print the count.
Data analysis labNumPy problems
Problem 17 of 50 · Masks · Easy
Count the even numbers
Sum a boolean mask to count matches.
Preparing NumPy, Pandas, and MatplotlibShift+Enter runs the cell you are in.
1
Your solution
2