Python program to find whether a given number (accept from the user) is even or odd, print out an appropriate message to the user.


Topic: Python program to find whether a given number (accept from the user) is even or odd, print out an appropriate message to the user.

Solution

def check_number(num):
    mod = num % 2
    if mod > 0:
        return "This is an odd number."
    else:
        return "This is an even number."
print(check_number(5))



List all Python Programs