With an input of a 32 bit integer, reverse the bits and return the number.
Input: 123
# AKA 0000 0000 0000 0000 0000 0000 0000 0111 1011
Output: 57713623040
# AKA 1101 0111 0000 0000 0000 0000 0000 0000 0000
Your code should fit into the following pseudocode:
def convert_to_bits(n) {
return '{0:08b}'.format(n)
}
def bitwise_reverse(num) {
#Your Code Here
}
print(convert_to_bits(123))
# 1111011
print(bitwise_reverse(123))
# 57713623040
print(convert_to_bits(bitwise_reverse(123))
# 110101110000000000000000000000000000