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

William Bardall
William Bardall
1,952 Points

Am I missing something?

The code challenge wants a function to return of True if a number is even or False if it is odd. I wrote a tiny program to test to see if my function works, it appears to work fine, but the code challenge isn't accepting it as correct.

def even_odd(number):
    if number %2 == 0:
        print("True")
    else:
        print("False")

while True:
    number = int(input("Enter a number to see if it is even: "))

    even_odd(number)
even.py
def even_odd(number):
    if number %2 == 0:
        print("True")
    else:
        print("False")

1 Answer

Clayton Perszyk
MOD
Clayton Perszyk
Treehouse Moderator 46,128 Points

Although your code is checking for odd or even, you need to return boolean values, not print strings.

William Bardall
William Bardall
1,952 Points

Thanks! I'll see what I can do with this feedback!