A bit shift moves each digit in a number's binary representation left or right. There are three main types of shifts:
When shifting left, the most-significant bit is lost, and a 0 bit is inserted on the other end.
The left shift operator is usually written as "<<".
A single left shift multiplies a binary number by 2:
When shifting right with a logical right shift, the least-significant bit is lost and a 0 is inserted on the other end.
For positive numbers, a single logical right shift divides a number by 2, throwing out any remainders.
When shifting right with an arithmetic right shift, the least-significant bit is lost and the most-significant bit is copied.
Languages handle arithmetic and logical right shifting in different ways. Python's right shift operator (>>) always does arithmetic right shifting.
The first two numbers had a 1 as the most significant bit, so more 1's were inserted during the shift. The last two numbers had a 0 as the most significant bit, so the shift inserted more 0's.
If a number is encoded using two's complement, then an arithmetic right shift preserves the number's sign, while a logical right shift makes the number positive.