题解 | #进制转换#
进制转换
http://www.nowcoder.com/practice/8f3df50d2b9043208c5eed283d1d4da6
1、从个位数加起,所以首先对输入的字符串进行倒序N[::-1] 2、累加时注意加权,依次为1、16、16*16、…… 3、循环完输出结果 4、当然在python的世界里有一句函数可以结束本例子 print(int(input(),16) 备注:int(str,N),N代表输入的数据是几进制的。 类似的有其他函数 bin() oct() hex()