# How To Check If A Number Is Even In Python

In this tutorial, you will learn how to check if a number is even in Python.

You can check directly if the number is divisible by 2. If the number is completely divisible by 2 then it is an even number but if the given number is not divisible by 2 then it is called an odd number.

## Check If A Number Is Even

In Python, the modulus operator can be used to determine whether or not a remainder exists when a given number is divided by two. If the remainder is zero, the input number is even; if the remainder is greater than zero, the input number is odd.

Let us see the example code to check if a number is even or odd in Python.

```#Taking the input from the user
getNum = int(input("Enter the Number to Check Even or Odd.\n"))

#Check if A Number is Even
if getNum%2==0:
print("{} Number is Even.".format(getNum))
else:
print("{} Number is Odd.".format(getNum))```

Output:

``````Enter the Number to Check Even or Odd.
10
10 Number is Even.

Enter the Number to Check Even or Odd.
11
11 Number is Odd.``````

As you can see in the above code, using the modulus operator I was able to check if the remainder is zero when divided by 2 then it is even otherwise it is an odd number.

## Wrap Up

I hope you understood how to check if a number is even in Python. You can simply check the remainder when divided by 2 and if the remainder is zero then the number is even otherwise the number is odd.

Let me know in the comment section if you know any better solution than the one discussed above I will be happy to add it here.

If you liked the above tutorial then please follow us on Facebook and Twitter. Let us know the questions and answer you want to cover in this blog.