This hex()
function returns the absolute value of a number.
abs(number)
Here,
Note: If the number is a complex number, its magnitude is returned. If the number is an integer with a base other than 10 the abs()
function will return its value as a decimal integer.
>>> hex(100)
'0x64'
>>> hex(-30)
'-0x1e'
>>> hex(0b11)
'0x3'
>>> hex(0o67)
'0x37''
>>> abs(0x10)
16
>>> abs(0b10)
2
>>> abs(0o20)
16