Binary to octal conversion in Python

Source code :

binary = input("Enter number in Binary Format: ")
temp = int(binary, 2)
print(binary,"in Octal =",oct(temp))

Output :

Enter number in Binary Format: 10101
10101 in Octal = 0o25

Output :


                

Comments :