Skip to main content

Posts

Showing posts from September 12, 2020

BIT-WISE OPERATORS

  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       0         0   0       1         0     0       0         0     Example:   a=15 -    1111                       B=6 -     0110                                                     a & B = 0110                                 = 6 (DECIMAL)       2

Contact form

Name

Email *

Message *