How to check if an array contains a pair of numbers whose product is even in Python

1 Answer

0 votes
# A produce of a pair of integers will always be even if at least 1 of them are even

def array_contains_a_pair_of_even_product(arr):
    for num in arr:
        if num % 2 == 0:
            return True
    return False

arr = [1, 1, 3, 3, 5, 5, 8, 9, 9, 11] # 8 * ? = Even

print(array_contains_a_pair_of_even_product(arr))





'''
run:

True

'''

 



answered Jun 15, 2024 by avibootz
...