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 trialannikaheflin
577 PointsI don't know how to make number even or odd
I need help figuring out how to get the number even or odd
def even_odd(number):
if number%2:
return True
else:
return False
2 Answers
Steven Parker
231,236 PointsYou have the right idea, but you need to return the opposite of the remainder. Try putting "not" in front of the expression.
annikaheflin
577 PointsThank you for explaining
annikaheflin
577 Pointsannikaheflin
577 PointsCan 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
231,236 PointsSteven Parker
231,236 PointsThe expression is "number%2", which calculates a remainder. The "not" would go between that and the "if".