@Seasean

could you please tell me why my code doesn't work?

def reverseBits(self, n):
if n == 0: return 0
result = 0
for i in range(32):
result << 1
if n & 1 == 1:
result += 1
n >> 1
return result

result += 1 did int number +1, not binary add.

why yours work?

thank you in advance!