Python Python Basics (2015) Number Game App Even or Odd

STEVEN PENA
STEVEN PENA
13,778 Points

This one should be short and sweet. Write a function named even_odd that takes a single argument, a number.

am a little struck

even.py
def even_odd(number):
    if number == 8 % 2:
        return True
    else:
        return False

1 Answer

Hey, so your syntax for the function is correct.

However, the logic needs a little tweaking. In programming, there's a very simple and basic way to evaluate if a given number is even or odd.

If you use modulo division with an even number and 2, the answer should be 0. Conversely, if you were to perform modulo division using an odd number with 2, you get 1 as an answer.

So all you need to do is change the condition in the if statement accordingly so that 'True' is returned when you pass a number parameter and performing modulo division on it with 2 equals to 0.

Hope that helped!

STEVEN PENA
STEVEN PENA
13,778 Points

am still a little stuck