Convert a given positive integer (including 0) to its hexadecimal string representation. Implement def to_hex(num): without using Python's built-in hexadecimal conversion functions. Return lowercase hexadecimal digits with no leading zeroes, except that zero must return "0".
a through f.hex() or formatted hexadecimal output.def to_hex(num):