ISBN Corruption
Description:
ISBN
An ISBN (International Standard Book Number) is a ten digit
code which uniquely identifies a book. The first nine digits represent the book and the last digit is used to make sure the ISBN is correct. To verify an ISBN you calculate 10
times the first digit, plus 9
times the second digit, plus 8
times the third... all the way until you add 1
times the last digit. If the final number leaves no remainder when divided by 11
the code is a valid ISBN.
For example 0201103311
is a valid ISBN, since 10*0 + 9*2 + 8*0 + 7*1 + 6*1 + 5*0 + 4*3 + 3*3 + 2*1 + 1*1 = 55.
Each of the first nine digits can take a value between 0
and 9
. Sometimes it is necessary to make the last digit equal to ten; this is done by writing the last digit as X
. For example, 156881111X
.
Write a program that reads in an ISBN code (will always be valid) with a single missing digit, marked with a ?
, and outputs the correct value for the missing digit.
Example:
15688?111X => "1"
020161586? => "X"
Input/Output
[input]
string representing the 10-digit ISBN code15688?111X
[output]
string representing the missing digit'1'
Similar Kata:
Stats:
Created | Dec 19, 2023 |
Published | Dec 20, 2023 |
Warriors Trained | 345 |
Total Skips | 1 |
Total Code Submissions | 769 |
Total Times Completed | 170 |
Python Completions | 170 |
Total Stars | 6 |
% of votes with a positive feedback rating | 89% of 44 |
Total "Very Satisfied" Votes | 36 |
Total "Somewhat Satisfied" Votes | 6 |
Total "Not Satisfied" Votes | 2 |
Total Rank Assessments | 12 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 8 kyu |