- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

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

# Check whether product of 'n' numbers is even or odd in Python

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 −

## Example Code

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

## Input

[5,7,4,2,6]

## Output

Even

- Related Articles
- Check whether given floating point number is even or odd in Python
- 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
- C++ Program to Check Whether Number is Even or Odd
- Java Program to Check Whether a Number is Even or Odd
- Check if count of divisors is even or odd in Python
- 8085 program to check whether the given number is even or odd
- State whether the following statements are True or False:(a) The sum of three odd numbers is even.(b) The sum of two odd numbers and one even number is even.(c) The product of three odd numbers is odd.(d) If an even number is divided by 2, the quotient is always odd.(e) All prime numbers are odd.(f) Prime numbers do not have any factors.(g) Sum of two prime numbers is always even.(h) 2 is the only even prime number.(i) All even numbers are composite numbers.(j) The product of two even numbers is always even.
- Python Program for Check if the count of divisors is even or odd
- Check if product of digits of a number at even and odd places is equal in Python
- Count Numbers with N digits which consists of odd number of 0's in C++
- Python Program to Determine Whether a Given Number is Even or Odd Recursively
- How to Check if a Number is Odd or Even using Python?
- Count Numbers with N digits which consists of even number of 0's in C++
- Largest Even and Odd N-digit numbers in C++

Advertisements