Solution 1

def even_or_odd(num):
    if num % 2 == 0:
        return 'even'
    elif num % 2 !=0:
        return 'odd'

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'

Test Cases

test with even number - Run Test

def test_with_even_number():
    assert even_or_odd(42) == 'even'

test with odd number - Run Test

def test_with_odd_number():
    assert even_or_odd(17) == 'odd'
def even_or_odd(a_number): pass