Question: Python3 (3) ISBN Check Digits The International Standard Book Number (ISBN) is (prior to 2007) a 10-digit code that uniquely specifies a book. The rightmost

Python3

(3) ISBN Check Digits The International Standard Book Number (ISBN) is (prior to 2007) a 10-digit code that uniquely specifies a book. The rightmost digit is a checksum digit which can be uniquely determined from the other 9 digits from the condition that d1 + 2d2 + 3d3 + ... + 10d10 must be a multiple of 11 (here di denotes the ith digit from the right). Example: the checksum digit corresponding to 020131452d10 is the only value of d10 is between 0 and 10 and that would be: 1*0 + 2*2 + 3*0 + 4*1 + 5*3 + 6*1 + 7*4 + 8*5 + 9*2 + 10*d10 which is a multiple of 11. To calculate d10: Find 1*0 + 2*2 + 3*0 + 4*1 + 5*3 + 6*1 + 7*4 + 8*5 + 9*2) = 115 then find the remainder of 115%11 = 5 which is the value of the10th digit d10 = 5.

So, the 10 digit ISBN is now 0201314525 - and we can check and see that (115+10*5)%11 = 0 is true.

Using the function design recipe, define a Python function, isbn_gendigit, with one parameter, isbn, a 9-digit string. The function should compute the check digit for a given ISBN, and then print out the 10-digit ISBN. isbn_gendigit will return the value None (end of the function, type return None).

Test your function on the following examples:

>>> isbn_gendigit('020131452')

0201314525

>>> isbn_gendigit('068131921')

0681319216

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!