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

I don't know how to make number even or odd

I need help figuring out how to get the number even or odd

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

2 Answers

Steven Parker
Steven Parker
231,236 Points

You have the right idea, but you need to return the opposite of the remainder. Try putting "not" in front of the expression.

Can you please explain more about the opposite and "not" and where there should be placed. I am confused. I don't really understand where remainder and expression are.

Steven Parker
Steven Parker
231,236 Points

The expression is "number%2", which calculates a remainder. The "not" would go between that and the "if".

Thank you for explaining