#1

I'm stuck on is_even, can someone plz tell me how to find if the number is even?

#2

Hello @tunihi,

def is_even(num):
# Return True or False, depending on if the input number is odd.
# Even numbers are 0, 2, 4, 6, and so on.

The other version would be `is_odd`

def is_odd(num):
# Return True or False, depending on if the input number is odd.
# Odd numbers are 1, 3, 5, 7, and so on.

#3

hi @tunihi,

as @0xb4dc0ded mentioned, a number that is even includes examples like 2, 4, 6, 8 and so on. What is a common similarity among all these numbers? That's right, they are all divisible by 2. So all that you need to do is to find out how you can check if a number if divisible by 2.

Here's a final hint: recall the modulo function, `%`.

#4

I know the odd and even numbers, because I read the question a lot but I'm not sure how to check it. The internet says to do num % 2 == 0 but it raises an error saying invalid syntax
x % 2 == 0
^

#5

I know that, it still doesn't work

#6

#7

@tunihi
I don't understand the issue.

If you want to check if a number is even, e.g. 5, just write `is_even(5)` and assign it to a variable or a `if`-statement.

#8

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

#9

nvm, missed a colon.

#10

I don't understand the purpose of this code, buuuut I didn't code much in Python at all.
So if it works, than it's good .... I guess

#11

good job noticing it