Write a function isValidIsbn10(code). code is an ISBN-10 as text. It is valid when it has 10 characters, the first 9 are digits, the last is a digit or X (which means 10), and digit 1 times 10 + digit 2 times 9 + ... + digit 10 times 1 divides by 11. Give back true or false.
You will practice: check digits, validation, loops, remainder (%)
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.