#ottit #pythontutorialintelugu
Python Bitwise Operators | Python Tutorial in Telugu | ottit
Bitwise operators works on values based on it’s binary values 0,1
1. & - called as AND – returns 1 only when both bits are 1
var1 & var2
2. | - called as OR - returns 1 when any of the bit is 1
var1 | var2
3. ^ - called as XOR – returns 1only when one of the bit is 1
var1 ^ var2
~ - called as NOT – Returns the complement of value
~var1
Binary Left Shift – moves the bits of number to left by n positions. Value of the number gets *multiplied.
var1 Binary Left Shift n
Binary Right Shift – moves the bits of number to right by n positions. Value of the number gets divided.
var1 Binary Right Shift n