Python - hex()

The hex() function converts a decimal integer into hexadecimal number with 0x prefix.

>>>hex(18)
'0x12'
>>>hex(255)
'0xff'
>>>hex(-64)
'-0x40'

Learn Python using coding questions with answers.

Python Questions & Answers

Want to check how much you know Python?

Start Python Skill Test