An ISBN-10 book code has 10 digits. The last one is a check digit. Write a function isbn10CheckDigit(first9) that gets the first 9 digits as text and gives back the check digit as text. How: multiply the digits by 10, 9, 8 ... 2 and add them up. The check digit is (11 - total % 11) % 11. If that is 10, give back "X".
You will practice: check digits, loops, remainder (%), text and numbers
Press Tab to indent. Press Esc and then Tab to move on to the next button.
Your code runs in your browser. We do not receive it or save it.
Test results
What your code printed
CC BY-SA 4.0
Adapted from a CS Unplugged programming challenge by the University of Canterbury Computer Science Education Research Group, licensed CC BY-SA 4.0.
Changes: Rewritten in our own words as a function with tests, hints and steps, in Python and JavaScript, by Open Cosmos. This version is also CC BY-SA 4.0.
Accessibility settings
Change how Open Cosmos looks and moves. Your choices are saved only in this browser.