A bit confused with the explanation:

An easy way to look at bit shifting is to visually move the bits in the specified direction by the specified amount. If we have a bit string of `1000`

and shift right by 1, we end up with `0100`

. Shift right by another 1 and we get `0010`

.

If we have `0010`

and shift right by 2, however, we lose our bit! And there’s no getting it back after it falls of the beginning or end, so be careful! We’d end up with `0000`

.

So given some variable like `my_bit_string = 0b1000`

, we can get `0b0001`

by doing `my_bit_string = my_bit_string >> 3`

.

That part:

If we have `0010`

and shift right by 2, however, we lose our bit! And there’s no getting it back after it falls of the beginning or end, so be careful!

In our case:

shift_left = 0b1

We do this shift_left = shift_left << 2

And we get 0b100

But why? Isn’t 1 supposed to fall of at the beginning OR end like they mention in the explanation, so that we end up with 0 instead of 4(0b100)?