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

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

i know am close to the answer i just need some help

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

1 Answer

nicole lumpkin
PLUS
nicole lumpkin
Courses Plus Student 5,328 Points

You are so close!! First, instead of calling your function with the number five, you should use a variable to represent any number that might be passed into your function.

def even_odd(num):

Then, reassess how you've written your if statement. You basically want that statement to read if some number divided by two yields a remainder that is zero, then return True. Otherwise return False. Lastly, remember to use the variable num, or any variable of your choosing, inside of the function as a representative of whatever number may be passed to your function! If you need more just message back :) Ps. You are right to use the modulo (%) operator. I think you'll be able to get it if you walk away from the code for a few, then return when you're fresh!

Thank you for breaking that down, I was confused