Question: I am looking for help with a Python program. The assignment requires the conversion of ISBN numbers and verifying of check digits to see it

I am looking for help with a Python program. The assignment requires the conversion of ISBN numbers and verifying of check digits to see it the ISBN entered is valid. I have the menu built, but I'm struggling with how to do the math functions needed. Specifically. The assignment calls for an ISBN to be entered by the user. The first nine digits must each be multiplied by a different number, and the totals added to a tenth number for an ISBN with ten digits. I also need assistance with the how to do this on a 13 digit ISBN. I'm just hoping for help to get pointed in the right direction on how to do this so I can finish building my program. I assume this will have something to do with an index or list, but performing the math needed is what is throwing me off here. I did look at other versions of this question that were already answered, but I couldn't find what I'm looking for.

Here is the info from the assignment:

Ten digit ISBN numbers are created so that the first nine digits are information digits and the last digit is a check digit. This last number helps people notice and correct mistakes that might be made in recording the information digits. The same is true for thirteen digit ISBN numbers. Here is a ten digit ISBN number: 0-13-149498-8. The digit 0 indicates the book is written for Englishspeaking people. The number 13 and the number 149498 identify the publisher and the book published by that publisher. The last digit, the 8, is the check digit. It was chosen in the following way: each digit is given a weight by using the digits 1 to 10 and counting left to right. These weights are added. The sum is:

0(1) + 1(2) +3(3) + 1(4) + 4(5) + 9(6) + 4(7) + 9(8) + 8(9) + __

(The digits of the ISBN information numbers are listed in order from left to right and weighted by counting up from 1 to 9.) The check digit is chosen to be a number from 0 to 10 so that this weighted sum is a multiple of 11. That is, the sum must be divisible by 11. (If the check digit turns out to be 10 then in this case an X is displayed representing the Roman numeral for 10.)

Let us see what sum we have so far with these particular nine information digits:

0(1) + 1(2) +3(3) + 1(4) + 4(5) + 9(6) + 4(7) + 9(8) + 8(9)

= 0 + 2 + 9 + 4 + 20 + 54 + 28 + 72 + 72

= 261

The check digit 8 was chosen because 261 is between 253 and 264 (multiples of 11) and 261 is 8 more than 253. The only possible number from 0 to 10 to use as a check digit is 8. Thus we have: A ten digit ISBN number: 0-13-149498-8

If you know the ten digit ISBN number you can calculate the thirteen digit ISBN number. Simply start the thirteen digit ISBN number with 978, then re-calculate the check digit. For example, 0-13-149498-8 becomes 978-0-13-149498-? Calculating the check digit for the thirteen digit ISBN number is done differently than for the ten digit ISBN number. Below is the way to calculate the thirteen digit ISBN check digit.

Note that on a thirteen digit ISBN number the weighted numbers are different:

1 3 1 3 1 3 1 3 1 3 1 3

9(1) + 7(3) + 8(1) + 0(3) + 1(1) +3(3) + 1(1) + 4(3) + 9(1) + 4(3) + 9(1) + 8(3) + __

=9 + 21 + 8 + 0 + 1 + 9 + 1 + 12 + 9 + 12 + 9 + 24

=115

The sum must be divisible by 10 for a thirteen digit ISBN. The check digit 5 was chosen because 115 divided by 10 is 11 with remainder 5. The remainder is the check digit. Thus we have: A thirteen digit ISBN number: 978-0-13-149498-5.

Write a python program which displays a simple menu as follows:

Python ISBN Conversion Menu

1. Verify the check digit of an ISBN-10

2. Verify the check digit of an ISBN-13

3. Convert an ISBN-10 to an ISBN-13

4. Convert an ISBN-13 to an ISBN-10

5. Exit

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!