Bitwise operator | Sololearn: Learn to code for FREE!

+1

Bitwise operator

Can somebody explain why this results in 32? x=5 print(x>>2<<x) I know 5>>2 is 1 And 2<<5 is 64. Where does the 32 come from?

11/25/2017 5:43:48 AM

Mikelforce

3 Answers

New Answer

+3

x = 5 (0000 0101) 1. 5 >> 2 (0000 0001) = 1 2. 1 << 5 (0010 0000) = 32

0

Got it. Thanks!