# Is_even Stumped!

#1

I don’t know how to solve this. I don’t think I’ve learned anything that can detect whether or not something is a decimal or a whole number. I get the idea that it has to be divisible by 2, but I don’t know any further. Probably missing something obvious. Thanks for help!

#2

The instructions are clear on what to do if it’s divisible/not divisible by 2. Did you read the instructions by any chance? Can you also post your code? That would help Thanks!

#3

All right! Let’s get started.

Remember how an even number is a number that is divisible by 2?

Instructions
Define a function is_even that will take a number x as input.
If x is even, then return True.
Otherwise, return False.
?
Hint
The modulo % operation is useful for determining if one number is divisible by another.

Make sure to return True instead of printing it!

I don’t see anything there that serves as a good hint. I tried this:
def is_even(x):
if x % 2 == True:
return True
else:
return False
but I knew it wouldn’t work

#4

Look at your `if` statement, why check if it’s equal to a boolean? If we want to check if `x` is fully divisible, we want our remainder from `x % 2` to be zero. Do you get the hint?
Also, make sure your code is indented properly

#5

OH, ok, thank you! That makes sense.

#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.