Skip to content
Home » Even Number Python Program using Function

Even Number Python Program using Function

Learn about Even Number Python Program using Function in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.

Even Number Python Program using Function

# Python program to check given number is an even or not using function

# Returns true if num is even, else not even 
def isEven(num):
 return (num % 2 == 0)


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

# print result
if isEven(num):
 print(num," is an even number")
else:
 print(num," is not an even number")

Output:

Enter a number: 4
4 is an even number

Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.

Similar Code : Check if the Number is Even in Python