ExampleEdit & Run
#Use the hex() function

print(hex(50))
copy
Output:
0x32 [Finished in 0.010387487709522247s]

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.

Syntax:
hex(x)
copy
x A decimal integer(in base 10) that is to be converted to hexadecimal representation
ExampleEdit & Run
print( hex(8) )

print( hex(10) )

print( hex(16) )

print( hex(20) )

print( hex(50) )

print( hex(64) )

print( hex(100) )

print( hex(256) )
copy
Output:
0x8 0xa 0x10 0x14 0x32 0x40 0x64 0x100 [Finished in 0.010682727210223675s]