[Tutor] & syntax

kinuthia muchane muchanek at gmail.com
Tue May 27 11:50:30 CEST 2008


Hi,
>>> 2&1
0
>>> 3&1
1
>>> 4&1
0
>>> 5&1
1
>>> 99&1
1
>>> 100&1
0
>>> 100&2
0

Would someone kindly explain to me what is going on here. All I can see
is even numbers return a '0' and odds a '1'. I also know all even
numbers in binary  end in a zero. I had thought '&' was another way of
writing the 'and' operator, seems I was wrong.

Thanks!
Kinuthia...



More information about the Tutor mailing list