Not sure about caret (^), but I believe | is binary or. 4|2 is 100 | 010 = 110, and 110 in decimal is 6. 4|4= 100|100 is 100 or 4.
The caret might be binary and, but I am not sure. On 1/28/11, tee chwee liong <tc...@hotmail.com> wrote: > > hi, > > i'm confuse on how does ^ and | mean. When i tried |, i thought it is > addition but 4|4 also give 4? >>>> 4|2 > 6 >>>> 4|1 > 5 >>>> 4|3 > 7 >>>> 4|4 > 4 > > When i tried ^, looks like subtraction but 2^4 gives 6? > > >>>> 2^3 > 1 >>>> 2^2 > 0 >>>> 2^4 > 6 > > Pls help to clear my confusion. thanks. > > > > > -- Have a great day, Alex (msg sent from GMail website) mehg...@gmail.com; http://www.facebook.com/mehgcap _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor