#Use the hex() function
print(hex(50))
The hex()
function is used to convert an integer number to a hexadecimal string, prefixed by '0x'. The hexadecimal notation is the representation of integers in the base 16, the notation uses digits 0 - 9 and characters from A - F.
hex(x)
x |
A decimal integer(in base 10) that is to be converted to hexadecimal representation |
Examples:
hex(8)
//'0x8'
hex(10)
//'0xa'
hex(16)
//'0x10'
hex(20)
//'0x14'
hex(50)
//'0x32'
hex(64)
//'0x40'
hex(100)
//'0x64'
hex(256)
//'0x100'