Python Program to Convert Decimal to Binary, octal, and Hexadecimal

Write a Python Program to Convert Decimal to Binary, octal, and Hexadecimal with an example. In this Python example, we used the bin (converts to binary), oct (for octal), and hex (for hexadecimal) functions.

decimal = int(input("Please Enter the Decimal Number = "))

binary = bin(decimal)
octal = oct(decimal)
hexadecimal = hex(decimal)

print(decimal, " Decimal = ", binary, "Binary Value")
print(decimal, " Decimal = ", octal, "Octal Value")
print(decimal, " Decimal = ", hexadecimal, "Hexadecimal Value")
Python Program to Convert Decimal to Binary, octal, and Hexadecimal

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.