In this tutorial, learn how to check if the number is even or odd using Python. The **short answer is** to use the %(modulo) operator with the Python if conditional statement.

The even number is the multiple of 2 and the odd is not multiple of 2. Find the type of any number whether it is even or odd using method here. In the end, you will also **find the other methods** to find the number is even or odd in Python.

## Check If The Number Is Even Using Python

An even number is a number which is **perfectly divisible by 2** without any remainder. It divides the number by 2 and gets the remainder to check if equals to 0. If the remainder is zero(0), it confirms the number is even.

If you want to find the number is even or not, you have to **use the %(modulo) operator**.

1 2 3 4 5 | myNum = 8 if myNum % 2 == 0: print("The number is even number.") else: print("The number is odd number.") |

Output

The above example finds the number which is even using the Python %(modulo) operator. You can change the above code as per your requirement to find the number if even.

## Find Out If the Given Number is Odd Using Python

An odd number is** not a perfect divisible of 2** and gives some remainder number also. If the number divides by 2 and gives a remainder which does not equal to zero(0). Then, it is the odd number in Python. Below is the simple method you can use to find the number if it is odd or not.

1 2 3 4 5 | myNum = 21 if myNum % 2 == 0: print("The number is even number.") else: print("The number is odd number.") |

Output

The above output shows that the** given number is odd**. You can also check your number if it is odd or not using the above example.

## Other Methods To Check Whether The Number Is Odd Or Even in Python

If you want to use other methods to find the number if even or odd. You can **use &(bitwise) operator** of Python to check. You have to use the below-given method to get the type in the output.

**Using Bitwise Operator in Python**

To find your number, you have to use the bitwise operator with the if statement.

1 2 3 4 5 | myNum = 21 if myNum & 1 == 1: print("The number is odd number.") else: print("The number is even number.") |

Output

The above output shows that the given number is odd using a bitwise operator. You can also check the even number whether it is even or not **using the same method**. Just put your number in the above example and find its type in the output.

Hope, you like this post of how to find the number is odd or even using Python. If you **have any query** regarding the tutorial, **please comment below**.

Also tell me, **which method you are using** to find the type of your number in Python.

Can you talk a little about how the bitwise operator and the & determines even or odd?