Hi guys,

I have come across a bit of code to find if a group of numbers is odd or
even.The code snippet is shown below:

if not n&1:
    return false

The above should return false for all even numbers,numbers being
represented by n.I have tried to wrap my head around the 'not n&1' but
I'm failing to understand what's going on.Could someone please explain
the statement.

Thanks in advance.

Boyks

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to