-
-
Notifications
You must be signed in to change notification settings - Fork 654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Luhn exercise test case expecting improper answer #1233
Comments
Okay, Yeah should read that twice. Instead of doing it from right, I was doing from left. Thanks. |
This happens a lot, so I'd like to re-word the test case annotations a bit to make this clearer. Thanks for opening the issue! |
Hi @bitfield. Is this still actual, in your opinion? I checked the readme that now states:
And again, some lines below:
There also is the link to the wikipedia page at the top of the page and it should be very clear, at least nowadays, and also in my opinion. Do you think it's safe to close this issue now? Thank you for considering my request. |
Well, people still continue to get it wrong (and they always assume that they are correct and that despite literally tens of thousands of people successfully completing the exercise, the test case must be wrong). I agree with you that the exercise itself makes the situation abundantly clear, but nevertheless, people who aren't paying attention see what they expect to see, and clearly they need a little more prompting here. |
Hey, I came across this exercise today and it seems like at least its description is misleading. It says, "double every second digit starting from the right". At the same time in all examples this procedure starts from the second rightmost digit ( Wikipedia says (see: https://en.wikipedia.org/wiki/Luhn_algorithm) it should start at the rightmost digit (the last one). So, with that knowledge, the example from above should look like this: |
Thanks, @kwiat1990. Following your reference, Wikipedia says:
In your example, 4539 3195 0343 6467, the rightmost digit is the last 7. So we wouldn't double that one, we'd double the second digit as we move leftwards. That would be the 6, and every second digit thereafter. So the exercise is correct, but as you and others have amply demonstrated, it's confusing! That's why I've suggested it be reworded to avoid this. |
@bitfield please take a closer look at the example on Wikipedia: for a The exact quote from Wikipedia says:
|
I am starting this exercise now and I believe the reason for the confusion @kwiat1990 is that in the first of the example, they show less digits than the actual card number.
So the idea here is that the sum should be evenly divisible by the 3 with no remainder. Few questions that I think I can easily figure out from running the test cases. But in the Wikipedia entry a checksum digit exists, but it does not here. The checksum is also not part of the sum (I believe). Additional, if a value is doubled, like 9 -> 18, the 1 & 8 are added to make it 9 again.
In the example given, when a What is different here is that the My thoughts are this -
Thoughts @bitfield? |
I think the Wikipedia page is probably not helpful here. Perhaps the best thing to do with the exercise instructions is to add the same kind of clarification that Wikipedia does:
|
Hi,
One of the test case for Luhn exercise is
{ "a valid Canadian SIN", "055 444 285", true, }
The sum is 35 which is not evenly divisible by 10. Am i missing anything?
Thanks
The text was updated successfully, but these errors were encountered: