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 (converts to octal), and hex (converts to hexadecimal) functions.

# Decimal to Binary, octal, and Hexadecimal
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