+ 1
Print (x >> 2)
During a challenge I got this question: x = 5 print(x >> 2) Can anyone explain to me what x >> 2 does?
3 odpowiedzi
+ 11
It shifts two bits to the right:
5 == 101 in binary
Two shifts to the right makes it:
101 --> 010 --> 001
001 in binary is 1 in decimal
So the result becomes 1
0
thanks