Element-wise greater than

EasyNumPy Programs · 9 of 100

Write a NumPy program for an element-wise “greater than” comparison.

Advertisement
Input
[8, 3], [9, 1]
Output
[False  True]

Approach

  1. np.greater(a, b) or a > b.

Solution

Python
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.

More numpy programs

← All 100 NumPy Programs

Leave a Comment