I have had problems with converting strings (like inputs) into denary, as a string is a necessary for using hexadecimal (as it can't be stored as an integer because of the characters a-f being included). Here are two attempts that don't work:
>>> hex_number = 'ff' #(255 in denary)
>>> ascii(0xhex_number)
SyntaxError: invalid hexadecimal literal
>>> ascii('0x'+hex_number)
"'0xff'"
I have also seen that you can use format()
somehow, but that didn't work either.
>>> format(hex_number, '16') #This was what the demo said to do.
'ff '
How can I get it so that hex_number
(hexadecimal) is converted to denary (aka decimal), or any other n-base number systems?