Home » Python Programs » Python Program to Find Odd or Even Using If Else

# Python Program to Find Odd or Even Using If Else

Basic python program to find odd or even using if else. In python, this program can determine whether a value is odd or even. Small children should figure out which number is odd and which is even, but they must learn how to do so in a programming language.

## Odd or Even number in Python

The integer entered by the user is stored in the variable num in the program. The modulus percent operator is then used to determine whether num is perfectly divisible by 2. The test statement number percent 2 == 0 evaluates to 1 if the number is completely divisible by 2.

## Print Statement in Python

The print() function outputs the message specified to the screen or another standard output device. The message can be a string or any other object; the object will be converted to a string before being displayed on the screen.

## If Else in Python

If not, then A Python statement determines whether or not an expression is true or false. The “if” statement is executed if a condition is met. Otherwise, the “else” statement takes effect. This is where conditional statements come into play. Conditional statements allow you to more effectively control the flow of your program. You can create a chain of if statements using the if/else if statement.

The if statements are evaluated one after the other until one of the if expressions is true or the end of the if/else if chain is reached. No code blocks are executed if the end of the if/else if chain is reached without a true expression. Using this if else statement we have executed the python program to find odd or even using if else

## Python Program to Find Odd or Even Using If Else

``````a = int(input("Enter the number to find odd or even "))
if (a % 2) == 0:
print("{0} is Even".format(a))
else:
print("{0} is Odd".format(a))
``````

Output:

Enter a number: 45

odd