Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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

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 48,850 Points

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

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