[Community Puzzle] ISBN Check digit

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Hi all

I coded the above mentioned puzzle.
All the check test cases pass, but one validator fails.

Unfortunately, there is no output from the validator, so I cannot know what’s the issue.

Any hint?

OK, got your code and will take a look. Please edit your post - avoid posting full code in the forum.

Also let us know which validator you are failing.

EDIT: ok, read your code. My tip: check the validity of EVERY character of an ISBN :wink:


I’m in the same case…
All IDE controls are Green but the last 2 don’t pass the validation.

I verify with regex pattern the ISBN.
IDE control ok so I think that my calculate is good…

Somebody have an idea

Thank you in advance

Confirmed. All examples are green, but last two validators fail.

Check whether your code passes the Example test case with new examples added.

Thanks for reaching out. Now one of the examples sends in “1X2”; a clearly invalid ISBN that is not 10 nor 13 digits. I changed my code to be able to handle this and report it as invalid. Now, my test only fails the validator on the third test: “Longer”.

It’s important that the validators are similar to the exercises so that we have a hope of debugging :wink: Thanks for your work on this one!

Hint: “1X2” has more than the issue of length. Read the last paragraph of the statement again.

1 Like

all IDE test OK green for all.

Validation : KO (longer and much much longer)…

[EDIT] : It’s OK for me… Thanks to Chingmann

Would you add a test checking this? The validators should not be checking requirements that are not checked by the tests. The validators are only for helping to detour hard-coded answers.

“1X2” does cover it.

I have the same issue, but I fail on Example, and pass all other tests. I check for length, all (except last) must be digits, and for validity of isbn as requested.

most likely 1X2 is discarded because of the invalid length, not because the other reason…

I failed to pass the longer validator.

EDIT: work now

OK, just added a new case in Example.

I have all test cases OK, but only “Short” validator is. I don’t understand why.
I pay attention to the length, if there is only digits, etc.

What do you mean? Only that validator is passed?

Yes, only that one :frowning:

I’m passing everything before I hit submit but then fail the example on submit. No idea why since I can’t debug. Any hints?

According to Wikipedia, the rule for the ISBN-10 check digit is:

… that the sum of all the ten digits, each multiplied by its (integer) weight, descending from 10 to 1, is a multiple of 11.

That means, your check digit is the number which has to be added to the check sum so it is divisible by 11. When it’s 0, you don’t have to add anything, because that means the number is already divisible by 11.
Maybe the statement should be updated to reflect this.