Bitwise operators BITWISE OPERATOR: BITWISE Operator in python are used to perform bitwise calculations on numbers (integers) Ø The name itself suggests that something to do with binary format like bits. Ø We cannot directly perform operations on integers so we need to convert them into binary format and then we need to do. Ø Result will be in decimal format. Types of bitwise operators: Ø Bitwise And - & Ø Bitwise OR - | Ø Bitwise NOT - ~ Ø Bitwise xOR - ^ Ø Bitwise right shift - >> Ø Bitwise left shift - << 1. Bitwise AND (&): this operator returns 1 if both the values are 1 or else it returns 0 x y x&y 1 1 1 1 ...
Help others by sharing this blog