0

I am trying to prompt a Hexadecimal string which I need to convert to a Binary by calling another function. How can I do it python?

Suppose, my Input is ABAB. Then, there will be a function which will take this hexadecimal string and return the resulting binary values (1010101110101011).

Damien Rice
  • 111
  • 5

1 Answers1

3
a = input()
hex_ = int(a, 16)
print(bin(hex_)[2:])

output:

ABAB
1010101110101011

I believe this is what you want

Fed_Dragon
  • 1,048
  • 1
  • 3
  • 15