Write a Python function to reverse the bits of an integer (32 bits unsigned).


Topic: Write a Python function to reverse the bits of an integer (32 bits unsigned).

Solution

def reverse_Bits(n):
        result = 0
        for i in range(32):
            result <<= 1
            result |= n & 1
            n >>= 1
        return result
    



List all Python Programs