mainmenu = input("Welcome to my ISBN calculator, please select an option\n\
1. Load ISBN Calculator\n\
2. Exit Program\n\
")
(mainmenu)
if mainmenu == ("2"):
print ("The ISBN Calculator will now close, thank you for using!")
time.sleep(1.5)
exit()
elif mainmenu == ("1"):
ISBN = input(" Please enter the 10 digit number exactly\n\
")
Digit1 = int(ISBN[0])*11
Digit2 = int(ISBN[1])*10
Digit3 = int(ISBN[2])*9
Digit4 = int(ISBN[3])*8
Digit5 = int(ISBN[4])*7
Digit6 = int(ISBN[5])*6
Digit7 = int(ISBN[6])*5
Digit8 = int(ISBN[7])*4
Digit9 = int(ISBN[8])*3
Digit10 = int(ISBN[9])*2
sum=(Digit1+Digit2+Digit3+Digit4+Digit5+Digit6+Digit7+Digit8+Digit9+Digit10)
num=sum%11
Digit11=11-num
if Digit11==10:
Digit11='X'
ISBNNumber=str(ISBN)+str(Digit11)
print('The ISBN number is --> ' + ISBNNumber)
这是我的代码,每当我尝试输入我的 10 位数字时,它总是出现未定义数字 1 的错误,有什么帮助吗?