# Please explain if x % 2 == 0:

if x % 2 == 0:

I have no idea on this line of code. Any idea?

1 answers ( 0 marked as helpful)

Hi Chong!

Thanks for reaching out!

`if x % 2 == 0`

means that if the remainder of a certain value divided by 2 would be zero, then the condition would be fulfilled. This means the same thing as saying *'if x is even*' because values divided by 2 that give a remainder of 0 are 2, 4, 6, 8...

4/2 = 2

6/2 = 3

The remainder is the value that 'remains' when dividing. For instance

5/2 = 2 with a remainder of 1 because 2x2 = 4 and 4+**1** gives 5.

Or 5 % 2 ==1

Hope this helps.

Best,

Ivan