Bit Rotation function.
Anonymous
Rotation (or circular shift) is an operation similar to shift except that the bits that fall off at one end are put back to the other end. # Max number of bits BITS = 8 def left_rotate(number, bits): """ Function to left rotate a number by the given bit count. """ return int('1'*BITS, 2) & ((number > (BITS - bits)))
Check out your Company Bowl for anonymous work chats.