ISBN check digit puzzle


#1

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?
EDIT CODE REMOVED AS REQUESTED


#2

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:


#3

Hi,

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


#4

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


#5

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


#6

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!


#7

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


#8

all IDE test OK green for all.

Validation : KO (longer and much much longer)...

[EDIT] : It's OK for me... Thanks to Chingmann


#9

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.


#10

"1X2" does cover it.


#11

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.


#12

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


#13

I failed to pass the longer validator.

EDIT: work now


#14

OK, just added a new case in Example.


#16

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.


#17

What do you mean? Only that validator is passed?


#18

Yes, only that one :frowning:


#19

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?


#21

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.


#23

This puzzle is a really frustrating one reagarding the difference between the test cases and validators. I am pretty sure I check for everything mentioned in the description and the test cases are all passed, but the Example validator still fails. Even more frustrating is that I cannot get any help in the forum because I am not allowed to post solutions. Please just get your test cases and validators right. One should not be able to pass test cases and fail validators.