Convert a given positive integer (including 0) to its hexadecimal string representation. Implement to_hex(num) without using the 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):