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 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