Here is my code:
noTest=int(input())
reverse=[]
nums=[]
for i in range(noTest):
nums.append(int(input()))
for num in nums:
binary=bin(num)
binNum=binary[2:]
rev=binNum[::-1]
rev=binary[:2]+rev+'0'*(32-len(rev))
#print int(rev,2)
reverse.append(int(rev,2))
for r in reverse:
print(r)
Input:
The first line of input consists number of the test cases. Each test case
contains a single 32 bit integer.
Output:
Print the reverse of integer.
Input:00000000000000000000000000000001 =1
Output:10000000000000000000000000000000 =2147483648
I have...
to what purpose? Know bit hacks? \$\endgroup\$