2024-11-21 05:05
Number = input("Enter the 32 bit number: "))
Rev_bi = Number[::-1]
print("the reverse number is",Rev_bi)
Or if the person enters integer or natural number, then
Num=int(input("Enter the number: "))
Binary=bin(Num)[2:]
#the [2:] essentially ignores the 0b that's automatically generated
Rev_bi=Binary[::-1]
print("the Binary form of the number entered is",Binary)
print("\nThe reversed Binary is:",Rev_bi)