Ok so what I am trying to do is append a check digit to the end of a number that the user has entered This is the code. I will explain afterwards.
isbn_list = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
isbn = [0,1,2,3,4,5,6,7,8,9]
isbnMult = [11,10,9,8,7,6,5,4,3,2,1]
number = input("Input ISBN number: ")
isbnnumber= 0
for i in range(len(number)):
found= False
count= 0
while not found:
if number[i] == isbn_list[count]:
found= True
isbnnumber= isbnnumber + isbn[count] * isbnMult[i]
else:
count += 1
total=isbnnumber%11
checkdigit=11-total
check_digit=str(checkdigit) #I know I have to append a number to a string
number.append(checkdigit) #so i thought that I would make the number into a
print(number) #string and then use the '.append' function to add
#it to the end of the 10 digit number that the user enters
but it doesn't work
It gives me this error:
number1.append(checkdigit)
AttributeError: 'str' object has no attribute 'append'
From my inexperience, I can only guess that that means that I cannot append a string? Any idea or suggestions on how I might go about appending the check digit to the end of the number entered by the user?