- Related Questions & Answers
- Check whether given floating point number is even or odd in Python
- C++ Program to Check Whether Number is Even or Odd
- Check whether the length of given linked list is Even or Odd in Python
- Check whether product of digits at even places is divisible by sum of digits at odd place of a numbers in Python
- Check if count of divisors is even or odd in Python
- 8085 program to check whether the given number is even or odd
- Python Program for Check if the count of divisors is even or odd
- Python Program to Determine Whether a Given Number is Even or Odd Recursively
- Adding only odd or even numbers JavaScript
- Check if product of digits of a number at even and odd places is equal in Python
- Java program to find whether given number is even or odd
- How to Check if a Number is Odd or Even using Python?
- Check whether product of digits at even places of a number is divisible by K in Python
- Finding the sum of two numbers without using '+', '-', '/', '*' in JavaScript
- Java Program to check if count of divisors is even or odd

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

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 −

- for i in range 0 to size of nums - 1, do
- if nums[i] is even, then
- return "Even"

- if nums[i] is even, then
- return "Odd"

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))

[5,7,4,2,6]

Even

Advertisements