Python Program to Check if a Number is Odd or Even

def evenodd(a):
if(a%2==0):
return 1
else:
return -1
a=int(input("Enter the number:"))
flag=evenodd(a)
if(flag==1):
print("Number is even")
if(flag==-1):
print("Number is odd")

Output:

Even Odd Number