Suppose we have an array nums. We have to check whether the product of these numbers is even or odd.
So, if the input is like nums = [5,7,4,2,6], then the output will be Even, as the multiplication is 1680 and this is even.
To solve this, we will follow these steps −
Let us see the following implementation to get better understanding −
def solve(nums): for i in range(len(nums)): if not nums[i] & 1: return "Even" return "Odd" nums = [5,7,4,2,6] print(solve(nums))