<doocs>0405.Convert a Number to Hexadecimal_1.py
def toHex( num: int) -> str:
    if num == 0:
        return '0'
    chars = '0123456789abcdef'
    s = []
    for i in range(7, -1, -1):
        x = (num >> (4 * i)) & 0xF
        if s or x != 0:
            s.append(chars[x])
    return ''.join(s)
def sample_funcname ( var_0 : int ) -> str :
    if var_0 == 0 :
        return '0'
    var_6 = '0123456789abcdef'
    var_7 = [ ]
    for var_11 in range ( 7 , - 1 , - 1 ) :
        var_14 = ( var_0 >> ( 4 * var_11 ) ) & 0xF
        if var_7 or var_14 != 0 :
            var_7.append ( var_6 [ var_14 ] )
    return ''.join ( var_7 )
