>
> > The above snippet is taking advantage of a similar property of binary
> > numbers, which are base 2. What the above snippet is doing is checking
> to
> > see if that last digit is a 0 or not (asking "not n&1" is equivalent to
> > asking "n&0", since that digit can only be a 0 or 1).
>
> Not quite.  The &1 is simply checking the least significant bit in the
> word.  n&0 will always give 0.  not n&1 checks whether the last digit
> -is- or -isn't- 1.
>
> S.


Not at all, you mean. I was way off with that statement; I'll plead not
guilty by virtue of not having had enough coffee today.

<8-(  (Wearing the dunce cap. . .)

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

Reply via email to