Question
The International Standard Book Number (ISBN) is a 13-digit code for identifying books. These numbers have a special property for detecting whether the number was
The International Standard Book Number (ISBN) is a 13-digit code for identifying books. These numbers have a special property for detecting whether the number was written correctly.
The 1-3-sum of a 13-digit number is calculated by multiplying the digits alternately by 1s and 3s and then adding the results. For example, to compute the 1-3-sum of the number
9780921418948 we add
9 1 + 7 3 + 8 1 + 0 3 + 9 1 + 2 3 + 1 1 + 4 3 + 1 1 + 8 3 + 9 1 + 4 3 + 8 1 and get 120.
The special property of an ISBN number is that its 1-3-sum is always a multiple of 10.
Write a program to compute the 1-3-sum of a 13-digit number. To reduce the amount of typing,
you may assume that the first ten digits will always be 9780921418, like the example above.
Your program should input the last three digits and then print its 1-3-sum. Use a format similar to the samples below.
Sample Interactive Session 1
Digit 11? 9
Digit 12? 4
Digit 13? 8
Write the code in python
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started