Write a NumPy program compare two given arrays
import numpy as np a = np.array([1, 2]) b = np.array([4, 5]) print("Array a: ",a) print("Array b: ",b) print("a > b") print(np.greater(a, b)) print("a >= b") print(np.greater_equal(a, b)) print("a < b") print(np.less(a, b)) print("a <= b") print(np.less_equal(a, b))
Sample Output:
Array a: [1 2] Array b: [4 5] a > b [False False] a >= b [False False] a < b [ True True] a <= b [ True True]
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer