+ 3
Python - Why is result 32?
x = 5 print(x>>2<<x)
2 odpowiedzi
+ 7
x>>2 0000_0101 (5) >> (shifted 2 places to the right) = 0000_0001 (1)
1<<5 0000_0001 (1) << (shifted 5 places to the left ) = 0010_0000 (32)
The operator is a bitwise shift. New binary places are set to 0.
+ 3
Quite difficult, but now I understand!