# Python Bitwise Operator - Toán tử với Bit trong Python Các toán tử thực hiện trên `bit` trong Python
**Operator****Description****Example**
& Binary ANDAND(a & b) (means 0000 1100)
| Binary OROR(a | b) = 61 (means 0011 1101)
^ Binary XORXOR(a ^ b) = 49 (means 0011 0001)
~ Binary Ones ComplementIt is unary and has the effect of 'flipping' bits.(~a ) = -61 (means 1100 0011 in 2's complement form due to a signed binary number.
<< Binary Left ShiftDịch bit sang tráia << 2 = 240 (means 1111 0000)
>> Binary Right ShiftDịch bit sang phảia >> 2 = 15 (means 0000 1111)
**- Ví dụ:** ```Python a = 60 # 60 = 0011 1100 b = 13 # 13 = 0000 1101 c = 0 c = a & b; # 12 = 0000 1100 print "Line 1 - Value of c is ", c c = a | b; # 61 = 0011 1101 print "Line 2 - Value of c is ", c c = a ^ b; # 49 = 0011 0001 print "Line 3 - Value of c is ", c c = ~a; # -61 = 1100 0011 print "Line 4 - Value of c is ", c c = a << 2; # 240 = 1111 0000 print "Line 5 - Value of c is ", c c = a >> 2; # 15 = 0000 1111 print "Line 6 - Value of c is ", c ``` ```Python Line 1 - Value of c is 12 Line 2 - Value of c is 61 Line 3 - Value of c is 49 Line 4 - Value of c is -61 Line 5 - Value of c is 240 Line 6 - Value of c is 15 ```