Python Program to Check if a Number is Odd or Even

In this Python program, let’s learn how you can check a given number if it is odd or even.

How to Check if a Number is Odd or Even in Python?

A number is a even number if it is perfectly divisible by 2 i.e if the remainder is 0. In Python, you can use the modulus operator (%) to find the remainder. If the remainder is 0 , the number is a even number. If not, the number is a odd number.

# Author :
# Python Program to check if the input number is odd or even.

input = 45

if (input %% 2) == 0:
   print("{0} is Even Number".format(input))
   print("{0} is Odd Number".format(input))


45 is Odd Number

In the above program, we use the modulus operator and conditional (if statement) in python to find if the number is odd or even.