Skip to content
C

Problem 4: Compare Two Arrays Element-Wise

Easypython

Problem Description

Write a Python program that takes two NumPy arrays of the same length and prints a new array showing True where elements in the first array are greater than the corresponding elements in the second array, and False otherwise.

Input

Two lists of numbers, of equal length.

Output

A NumPy array of True/False values based on the element-wise comparison.

Constraints

  • Both lists will have the same number of elements.

Example Input

text
array1 = [10, 20, 5, 40], array2 = [8, 25, 5, 30]

Example Output

text
[ True False False True]

Concepts Covered

NumPy arrays, element-wise comparison, boolean arrays.

Input (stdin)

Output

Run your code to see output here...