Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Knowledge Discovery In Databases

Authors: Animesh Adhikari, Jhimli Adhikari

1st Edition

3319132121, 9783319132129

Students also viewed these Databases questions

Question

What questions do you have for us?

Answered: 1 week ago

Question

2. How is communication defi ned?

Answered: 1 week ago

Question

=+Understand the different types of personal brands in social media

Answered: 1 week ago