To convert octal to decimal number in python, you have to ask from user to enter a number in octal number system to convert it into decimal number to display the equivalent number in decimal format as shown in the program given below.
Following python program ask from user to enter any number in octal number system to convert it into decimal number:
# Python Program - Convert Octal to Decimal print("Enter 'x' for exit."); octal = input("Enter number in Octal Format: "); if octal == 'x': exit(); else: decimal = str(int(octal, 8)); print(octal,"in Decimal =",decimal);
Here is the sample run of the above Python program demonstrating how to convert octal number to decimal number:
Above is the inial output, now enter a number in octal to convert the same number in decimal form after pressing the enter key as shown here in below sample output:
Here is the same program with run on python shell:
You may also like to learn or practice the same program in other popular programming languages: