Return whether an input number is even or odd
Write a function that will take in a number, and return whether it's even or odd.
Hint: You'll need to use the % (modulus) operator to get the remainder when dividing by 2 to determine if the number is even or odd.
even_or_odd(57) == 'odd'
even_or_odd(2422) == 'even'
Solution 1
def even_or_odd(num):
if num % 2 == 0:
return 'even'
elif num % 2 !=0:
return 'odd'