槑呆 @ 2022-03-19 22:47:21
table = input()
num = []
Right_ISBN = []
sum = 0
for char in table: #去掉'-'拆解出各个数字放入num,注意这里把最后一位校验码(可能是X也读入了)
if char != '-':
num += char
for i in range(1,len(num)): #最后一位是校验码,不参与sum
sum += int(num[i-1]) * i
verification_code = sum % 11
#print(sum)
#print(verification_code)
if verification_code == 10: #要把10翻译一下
Right_ISBN = list(table)
Right_ISBN[len(table)-1] = 'X'
else:
Right_ISBN = list(table)
Right_ISBN[len(table)-1] = str(verification_code)
#看是否正确
if Right_ISBN == list(table):
print("Right")
else:
for i in Right_ISBN:
print(i,end='')
by 槑呆 @ 2022-03-19 22:48:38
新人想问一下问什么我绑定了邮箱和手机,还是下载不了测试数据呢,原来从来没下载过,次数限制应该够用阿
by AlgoEmperor @ 2022-03-19 22:59:57
你这python咋写的跟c++一样