Post Top Ad

Sunday, May 20, 2018

May 20, 2018

How to Check if a number is Odd or Even in Python 3

In this post, we will learn how to check whether a number entered by the user is even or odd.

You must have a basic knowledge of Operator and Control Statement in Python!



We also need to understand the meaning of the Odd and Even number So we can write a program easily.



A number is an even number if it can be divisible by 2 otherwise it's an odd number.


num = int(input("Enter a number: "))
if (num % 2) == 0:
   print("{0} is Even".format(num))
else:
   print("{0} is Odd".format(num))


Please Check. If you have any problem just send me an email : admin@khemputhea.com