Line | Description |
---|---|
1 | Function header of the function decToHex() with the input parameter x |
2 | Returns the hexadecimal representation of the number x . The hex() function normally returns a string in the following form: ‘0x….’. The function .split() removes the substring 0x from the string |
4 | Calls the function with the parameter 140 and prints the result |
def decToHex(x):
return hex(x).split('x')[-1]
print(decToHex(140))
8c