0000000000000 is a valid ISBN number, but my code says it's invalid. My code takes a 13-digit number and checks if it's valid or not.
Each of the first 12 digits of the ISBN is alternately multiplied by 1 and 3. Then, we sum them up and divide the sum by 10, and get the reminder. If 10 minus the reminder is equal to the 13th digit, then it's valid.
isbnNunmberCheck=input()
n1=int(isbnNunmberCheck[0])*1
n2=int(isbnNunmberCheck[1])*3
n3=int(isbnNunmberCheck[2])*1
n4=int(isbnNunmberCheck[3])*3
n5=int(isbnNunmberCheck[4])*1
n6=int(isbnNunmberCheck[5])*3
n7=int(isbnNunmberCheck[6])*1
n8=int(isbnNunmberCheck[7])*3
n9=int(isbnNunmberCheck[8])*1
n10=int(isbnNunmberCheck[9])*3
n11=int(isbnNunmberCheck[10])*1
n12=int(isbnNunmberCheck[11])*3
k=10-(n1+n2+n3+n4+n5+n6+n7+n8+n9+n10+n11+n12)%10
if k==int(isbnNunmberCheck[-1]):
print("Valid")
else:
print("Invalid")