isbn = []
for Count in range(1,14):
ISBN = int(input("Please enter the next digit of ISBN: "))
isbn.append(ISBN)
CalculatedDigit = 0
Count = 1
while Count < 14:
CalculatedDigit = CalculatedDigit + isbn[Count]
Count = Count + 1
CalculatedDigit = CalculatedDigit + isbn[Count] * 3
Count = Count + 1
while CalculatedDigit >= 10 :
CalculatedDigit = CalculatedDigit - 10
CalculatedDigit = 10 - CalculatedDigit
if CalculatedDigit == 10:
CalculatedDigit = 0
if CalculatedDigit == isbn[14]:
print ("Valid ISBN")
else:
print ("Invalid ISBN")
- 解释器返回“回溯(最近一次调用最后一次):文件“python”,第 9 行,在 IndexError:列表索引超出范围”