0
why print(2 <<3)is 16?
3 ответов
+ 7
its in binary
2 equals 0010
(0010 << 3) == 0001 0000 #left shift 3
0001 0000 equals 16
+ 3
Please use the search bar, similar questions have been asked may times
https://www.sololearn.com/learn/4087/?ref=app
+ 3
Another attempt in addition to what Slick wrote:
2 = 2^1
Left shift by three adds 3 to exponent so it is
2^(1+3) = 2^4 = 16