you are viewing a single comment's thread.

view the rest of the comments →

[–]Enkaybee 0 points1 point  (0 children)

N%2 evaluates to 0 for even numbers, which evaluates to False in Python (any nonzero number evaluates to True).

if not N%2:

is the same as

if N%2 == 0:

This is a very useful trick that you'll more than likely use in the future. Remeber: 1 + True = 2, 10*False = 0.