Python – Even Number


Python Program to Check if Number is Even

To check if given number is even or not in Python, we can divide the given number by 2 and find the remainder. If the remainder is equal to zero, then the given number is even, or else not.


If n is given number, then the boolean condition to check if n is even is

n % 2 == 0


In the following program, we take an integer value in n, and check if this number is even or not.

Python Program

n = 10

if ( n % 2 == 0 ) :
    print(f'{n} is even number.')
else :
    print(f'{n} is not even number.')
Run Code Copy


10 is even number.


In this tutorial of Python Examples, we learned how to check if a given number is an even number or not.

Related Tutorials

Code copied to clipboard successfully 👍