'if (n & 1)'  below works but I don't understand why/how.  Kindly help.

==============
>>> def fn(n):
...     if (n & 1):
...         print "n is odd"
...     else:
...         print "n is even"
...
>>> fn(5)
n is odd
>>> fn(4)
n is even

===============

Thanks
Ni
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to