Python – Odd Number


Python Program to Check if Number is Odd

To check if given number is odd or not in Python, we can divide the given number by 2 and find the remainder. If the remainder is equal to one, then the given number is odd, or else not.


If n is given number, then the boolean condition to check if n is odd is

n % 2 == 1


In the following program, we take an integer value in n, and check if this number is odd or not.

Python Program

n = 13

if ( n % 2 == 1 ) :
    print(f'{n} is odd number.')
else :
    print(f'{n} is not odd number.')
Run Code Copy


13 is odd number.


In this tutorial of Python Examples, we learned how to check if a given number is an odd number or not.

Related Tutorials

Code copied to clipboard successfully 👍