254
创建一个程序，将一个十进制数转换为十六进制数。
def number_converter(number): 
    #十六进制数系统
    hexadecimal = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"]
    
    # 转换为二进制
    binary = bin(number).replace("0b","")
    
    # 索引
    i = 0
    hexa = ""
    # 从 0 到二进制数的位数循环
    while(i < len(binary)):
        bit_four = binary[i : i + 4]
        remainder = bit_four % 16 #16 是十六进制的基数
        hexa += hexadecimal[remainder]
        i += 4
    return hexa 

res = number_converter(254)
print(res)
# 输出: FE