Python Program - Check if a Number is Odd or Even

http‮ww//:s‬w.theitroad.com

Here's a Python program to check if a number is odd or even:

num = int(input("Enter a number: "))

if num % 2 == 0:
    print(num, "is even")
else:
    print(num, "is odd")

In this program, we first ask the user to enter a number using the input() function. We convert the input to an integer using the int() function and store it in the variable num.

We then check if num is divisible by 2 using the modulus operator %. If the remainder is zero, we print that the number is even. Otherwise, we print that the number is odd.