First, you would have to multiply num1
by 256
, of course, not 100
(you could write decimal 256
as 0x100
, though, if that helps make your intention clearer).
Second, to format an integer as a hex number, use
print("{:x}".format(num))
For example:
>>> num1 = 0xff
>>> num2 = 0xab
>>> num = num1*256 + num2
>>> print("{:x}".format(num))
ffab