# Python Simple Odd and Even number

Contents

## Find whether the given number is Odd or Even

If you divide a number by 2 and it gives a remainder of 0 then it is known as an even number and if you divide a number by 2 and it gives a remainder of 1 then it is known as an Odd number.

Â

### Example

2%2 == 0 #remainder is 0 so it is even number.

4%2 == 0 #remainder is 0 so it is even number.Â

6%2 == 0 #remainder is 0 so it is even number.

8%2 == 0 #remainder is 0 so it is even number.

10%2 == 0 #remainder is 0 so it is even number.

12%2 == 0 #remainder is 0 so it is even number.

134%2 == 0 #remainder is 0 so it is even number.

Note: The number which has the last digit is (0,2,4,6,8) then we can say that is Even numbers. In Python 0 (False).

1%2 ==1 #remainder is 1 so it is odd number.

3%2 == 1 # remainder is 1 so it is odd number.

5%2 == 1 # remainder is 1 so it is odd number.

7%2 == 1 # remainder is 1 so it is odd number.

9%2 = =1 # remainder is 1 so it is odd number.

11%2 == 1 # remainder is 1 so it is odd number.

13%2 == 1 # remainder is 1 so it is odd number.

245%2 == 1 # remainder is 1 so it is odd number.

Note: The number which has the last digit is (1,3,5,7,9) then we can say that is Odd numbers. In Python 1 (True)

## Python Program to Count Odd and Even Number in a List

### Example

`number = [1,2,3,4,5,6,8,9]odd_count,even_count=0,0for i in number:    if (i%2==0):        even_count += 1    else:        odd_count += 1print("odd numbers in the lists :", odd_count)print("even number in the lists :",even_count)`

#### Output:

`C:\Users\Pramod\PycharmProjects\pythonProject\venv\Scripts\python.exe C:/Users/Pramod/PycharmProjects/pythonProject/main.pyodd numbers in the lists : 4even number in the lists : 4Process finished with exit code 0`

## Recommended Post:

Hi, Iâ€™m Pramod Kumar Yadav & a computer science Engineer with 3years of experience in Digital marketing. Iâ€™m self-motivated and love to do SEO.

## Best PYthon Course

Get More trending Courses