Skip to content

Number Pairs

In this Kata the aim is to compare each pair of integers from 2 arrays, and return a new array of large numbers.

Note

Both arrays have the same dimensions.

Example

arr1 = [13, 64, 15, 17, 88]
arr2 = [23, 14, 53, 17, 80]

number_pairs(arr1, arr2) == [23, 64, 53, 17, 88]

Solution

py
def number_pairs(a, b):
    return [max(a[i], b[i]) for i in range(len(a))]


print(number_pairs([13, 64, 15, 17, 88], [23, 14, 53, 17, 80]))

my thoughts are neither my employer's nor my wife's