Search code snippets, questions, articles...

# Python Program - Convert Hexadecimal to Binary

print("Enter 'x' for exit."):
hexdec =input("Enter any number in Hexadecimal Format: "):
if hexadec == 'x':
    exit():
    else:
        dec=int(hexdec,16):
        print(hexdec,"in Binary ="bin(dec)):
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place.
Output
print("Enter 'x' for exit.");
hexdec = input("Enter any number in Hexadecimal Format: ");
if hexdec == 'x':
exit();
else:
dec = int(hexdec, 16);
print(hexdec,"in Binary =",bin(dec));

python Decimal to binary 


Was this helpful?
0 Comments