# 2/15 Something appears to be switched around

#1

If I am reading the directions properly,
Define a function is_even that will take a number x as input.
If x is even, then return True.
Otherwise, return False.
than the proper code should look something like this:

def is_even(x):
if x % 2:
return True
else:
return False

However, when I entered that code, it said that for every number, False was returned when True was expected, and vice versa... therefore, I created this code:

def is_even(x):
if x % 2:
return False
else:
return True

and it worked... however, it just does not look correct... in my eyes, I am seeing that if x is divisible by 2, making it even, the code should return False... am I the only one that has run into this?

#2

if x % 2 (if it's even, then) == 0

so for example, you give a 2 as input, it says 2%2 == 0 and for a computer (or just python, I'm not sure there ^^ ) 0 means False, so it won't go through this way and goes to else

if you take 3 as an input, it says 3%2 == 1 (every other number than 0 is True), which means it will go this way