Pythonモジュロ関数が正しく機能していることを確認できないようです。さまざまな数値を試しましたが、正しい除算が得られないようです。
ISBN番号
print """
Welcome to the ISBN checker,
To use this program you will enter a 10 digit number to be converted to an International Standard Book Number
"""
ISBNNo = raw_input("please enter a ten digit number of choice")
counter = 11 #Set the counter to 11 as we multiply by 11 first
acc = 0 #Set the accumulator to 0
ループを開始し、文字列の各桁に減分カウンターを掛けます 各配置を取得するには、数値を文字列として扱う必要があります
for i in ISBNNo:
print str(i) + " * " + str(counter)
acc = acc + (int(i) * counter) #cast value a integer and multiply by counter
counter -= 1 #decrement counter
print "Total = " + str(acc)
Mod を 11 で割る (割って余りを取る)
acc = acc % 11
print "Mod by 11 = " + str(acc)
11から取る
acc = 11 - acc
print "subtract the remainder from 9 = " + str(acc)
文字列と連結する
ISBNNo = ISBNNo + str(acc)
print "ISBN Number including check digit is: " + ISBNNo