hex

Description

Returns an integer converted into a hexadecimal string.

Syntax

hex (integer)

integer
Required. An integer value to be converted into hex string.

Return Value

str

Time Complexity

#TODO

Note

To obtain a hexadecimal string representation for a float, use the float.hex() method.

Example

>>> hex(100)
'0x64'
>>> hex(-30)
'-0x1e'
>>> hex(0b11)
'0x3'
>>> hex(0o67)
'0x37'

See Also

#TODO