将输入的16进制作为字符串进行处理。 构建字典将16进制中的字符转化为数字。 dic = { 'A': 10, 'B': 11, 'C': 12, 'D': 13, 'E': 14, 'F': 15, } while True: try: raw = list(input()) length = len(raw) sum = 0 for i in range(length-1, 1, -1): if raw[i] in dic: ...