Python Check if a Number is Odd or Even

Published: Jun 23, 2022

In this snippet, we will learn how to check odd/even number in Python.

The Program

The source code of the program:

num = int(input("Enter a number: "))
if (num % 2) == 0:
    print("The number {0} is even".format(num))
    print("The number {0} is odd".format(num))

Output 1

Odd number:

Enter a number: 55
The number 55 is odd

Output 2

Even number:

Enter a number: 88
The number 88 is even