Validating isbn 10 c

Rated 4.77/5 based on 541 customer reviews

The only thing left is to combine these parts into a validation function function (this function assumes the ISBN has already been cleaned and is of correct length): and a different algorithm to calculate the control digit.

In the case of the current 13-digit ISBN, then it could be any single digit from zero to nine.

When the system calculate the check digit for 978168197271 it will come up with 8 as the check digit for that number.

It will compare 8 with 2 and know that a mistake of some sort has been made.

digits, with nine of them identifying the book and one serving as control digit.

The presence of a control digit ensures (to some extent) that the buyer receives the book she ordered and not something totally different.

This post describes a small module written in Haskell that takes a The latter test cases included some decorative spaces and dashes.

validating isbn 10 c-45

validating isbn 10 c-41

validating isbn 10 c-30

validating isbn 10 c-75

Nevertheless I landed on this page seeking answer to the same question, but in a Groovy context.

/* Check digit calculation is based on modulus 10 with digits in an odd position (from right to left) being weighted 1 and even position digits being weighted 3.

For further information on EAN-13 see: Wikipedia - European Article Number: Implementation based on Tests can be found there too */ boolean is Valid Ean(String code) users_gtin=raw_input("enter first seven digits of gtin ") gtin_seven_digits=unicode(users_gtin) if len(gtin_seven_digits) == 7 and gtin_seven_digits.isnumeric(): ck = ((((int(gtin_seven_digits[0])) (int(gtin_seven_digits[2])) (int(gtin_seven_digits[4])) (int(gtin_seven_digits[6])))*3) ((int(gtin_seven_digits[1])) (int(gtin_seven_digits[3])) (int(gtin_seven_digits[5]))))  final_ck = 10-ck if final_ck == 10: final_ck=0 print "Is your check digit",final_ck,"?

Since I actually succeeded in using the information on this page to come up with an answer to my own problem, I thought I'd share the result.

Especially the answers from Alex Dev, Zack Peterson and Mitch was helpful to me.

Leave a Reply