can you plz explain me shifting i am not getting it:

what's happening in here:

0b000001 << 2 == 0b000100 (1 << 2 = 4)

# Shifting

**sranjan**#1

**mtf**#2

Please include a link to the exercise with your question. Thanks.

```
bin(0b1 << 2) == 0b100
1 << 2 == 4
```

Like decimal integers, binary integers never have leading zeros.

```
0b1 << 1 == 0b10
0b10 << 1 == 0b100
```

A shift of the bit (or bits as a whole) to the left doubles its value.

**sranjan**#3

It's not any exercise specific questiuon ,i have completed this bitwise but i didn't understand:

Slide to the Left! Slide to the Right!

what does the expresion in bracket mean ?0b000100(1<<2=4)

what is shifting : does it mean if i shift two places to right: the right most number will replace number at 2nd possition

I know my question is not precise sory for that,plz explain me shifting

**mtf**#4

The shift takes place on the entire number.

`123 << 1 == 246`

The bit configuration is unchanged, but for the added zero in the lower order bit.

```
>>> bin(123)
'0b1111011'
>>> bin(123 << 1)
'0b11110110'
>>>
```

**system**#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.