Can someone please help me write a convertor for Hexidecimal to Decimal, has anyone found a way to allow for the entries to be able to be multiplied as integers, even if the input is a character and not a natural number.

Thanks Jack

....
If the input is a 9 chararcter, then digit to convert is equal to 9.
If the input is a A chararcter, then digit to convert is equal to 10.
If the input is a B chararcter, then digit to convert is equal to 11.
....

Python function int() will do this for you ...

hx = "FFFF"
# convert hexadecimal string hx to a denary (base 10) number
n = int(hx, 16)

print(n)  # 65535

Math with hexadecimal numbers ...

hx1 = "FF"
hx2 = "B7"
product = int(hx1, 16) * int(hx2, 16)

print("{} * {} = {} --> {:X}".format(hx1, hx2, product, product))

'''
FF * B7 = 46665 --> B649
'''
This article has been dead for over six months. Start a new discussion instead.