Python Program to check number is even or odd


In this program, You will learn how to check number is even or odd in Python.


if num % 2 == 0: 
   even 
else: 
   odd

Example: How to check number is even or odd in Python.

x = int(input("Enter a number:"))

if x % 2 == 0:
    print("Number is even:", x)
else:
    print("Number is odd:", x)

Output:

Enter a number:14
Number is even: 14