请问这个代码到底为啥错呢
dic1 = {0:'1',1:'0',2:'X',3:'9',4:'8',5:'7',6:'6',7:'5',8:'4',9:'3',10:'2'}def transid(ids):
ids = ids[:7] + "19" + ids
S = (int(ids*7) + int(ids*9) + int(ids)*10 + int(ids)*5 + int(ids)*8 + int(ids)*4 + int(ids)*2 + int(ids)*1 + int(ids)*6 + int(ids)*3 + int(ids)*7 + int(ids)*9 + int(ids)*10 + int(ids)*5 + int(ids)*8 + int(ids)*4 + int(ids)*2)/17
Y = S % 11
dic1
return dic1
ids = input("请输入15位")
print(transid(ids))
输入值为340524800101051
结果显示
dic1
KeyError: 4.882352940738201
这是什么错误原因呢 S是个浮点数,取余也会是浮点数 逃兵 发表于 2021-10-14 15:42
S是个浮点数,取余也会是浮点数
!明白了 谢谢
页:
[1]