To convert octal to binary in python, you have to ask from user to enter any number in octal format to convert that number in binary number system as shown in the program given here.
Following python program ask from user to enter octal number and convert that number into binary number:
# Python Program - Convert Octal to Binary while True: print("Enter 'x' for exit.") octal = input("Enter number in Octal Format: ") if octal == 'x': break else: dec = str(int(octal, 8)) decm = int(dec) print(octal,"in Binary =",bin(decm),"\n")
Here is the sample run of the above Python program demonstrating how to convert any octal number into binary number:
You may also like to learn or practice the same program in other popular programming languages: