题解 | #进制转换#
进制转换
http://www.nowcoder.com/practice/8f3df50d2b9043208c5eed283d1d4da6
num=input()[::-1] Dict={} keys = '0123456789ABCDEF' for i in range(16):#十六进制字典值对应 Dict[keys[i]]=i
length=len(num)-2#减去前缀,剩下16进制的字母 result=0 for i in range(length): result += Dict[num[i]]*(16**i) print(result)