In this simple Python program, you will learn **to check if a number is odd or even**. Before moving ahead, please ensure that you understand the basic concepts of Python programming, such as:

- Variables
- Python operators
- If-else statements

In case you have just started your Python journey, then here are some resources that you should check out:

- Learn Python Online With These 12 Best Free Websites
- 10 Best Books To Learn Python For Beginners And Experts
- 10 Best Udemy Python Courses for Beginners

Here are some similar Python program examples you should check out:

- Python Program To Check Prime Number
- Python 3 Program To Multiply Two Matrices
- Python 3 Program To Add Two Matrices
- Python 3 Program to Check Armstrong Number
- Python 3 Program To Convert Celsius To Fahrenheit

Python Program To Check If a Number is Odd or Even

Let’s now see how to check if a number is odd or even using Python code.

It is as simple as ABC. We will take input from the user and then check if the number is divisible by 2 or not. If the number is divisible by 2, it is an even number; otherwise, the given number is odd.

We will check the divisibility using the modulo operator (%) and use if-else Python statements to print if the number is odd or even.

Here’s the code for the same.

#Python program to check if a number is odd or even #Input number from user number = int(input("Enter a number to check odd or even \n")) #Checking if the nunmber is divisible by 2 or not #If the number is divisible by 2 then it is an even number if (number % 2) == 0: print("Number is even") #If the number is not divisble by 2 then it is an odd number else: print("Number is odd")

Other Python code examples you should check out:

- Working With Python 3 Lists | Learn By Examples
- Dictionary In Python 3 | Learn With Examples
- Sending Emails Using Python With Image And PDF Attachments
- How To Make A Simple Python 3 Calculator Using Functions
- How To Make A Digital Clock In Python Using Tkinter

### Output

Here’s the output of the above program.

**Must check out Python code snippets**:

- Python 3 Program to Find the Sum of Natural Numbers
- Python 3 Program To Find The Factorial Of A Number
- Python 3 Program to Find Largest Among Three Numbers
- Python 3 Program to Check Leap Year
- Python 3 Program To Check If Number Is Positive Or Negative