Hex() method in Python Built in Function
hex method in built in function converts the integer into its corresponding hexadecimal string.
Syntax:
hex(x)
Parameters
hex has a single parameter.
- X: this is the integer which gets converted into its corresponding hexadecimal string.
Example-1:
x = hex(398) print(x)
Output:
Example-2:
x = hex(-47) print(x)
Output:
Example-3:
number = 7.8 print(number, 'in hex =', float.hex(number))
Output:
