Python Practice › NumPy Programs › Program 9
Element-wise greater than
Write a NumPy program for an element-wise “greater than” comparison.
Input
[8, 3], [9, 1]
Output
[False True]
Approach
np.greater(a, b)ora > b.
Solution
import numpy as npprint(np.greater([8, 3], [9, 1]))Output
[False True]
Learn the concept
New to this topic? Read the lesson, then come back.