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
def even_odd(5):
        if 5 ==  % 2 
            return True
            return False

1 Answer

nicole lumpkin
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