+ 1
X=5 print (x<<2) I encounter this question under python challenge, the answer was 20, can anyone explain why?
2 ответов
+ 3
It is binary representation.
In binary 5= 0000 0101
Now 5<<2 means, all digits shift 2 positions towards left side.
After moves the digits become
0001 0100 is equal to 20
https://www.sololearn.com/learn/4087/?ref=app
+ 2
Vadivelan thanks for pointing me in the right direction