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