Luhn Algorithm

Back to General discussions forum

Legarts     2015-07-27 00:31:12

Can someone please look over this code and tell me where it goes wrong? It's always one of the answers that goes slightly wrong - either some digit is missing, that is working when I test this input by itself or the luhn sum reports back that no digit switch is required and my hand calculations seem to confirm it, yet the answer has the digit swap.

# I removed the code to prevent spoiling solution, as the author have found
# that code is correct and the problem is just technical - Admin :)
Legarts     2015-07-28 19:03:31

All right, turns out the solution was correct, there was just a problem when copying the answer from the shell. For the future reference, it would be a nice feature for CodeAbbey to point out the differences between expected answer and provided answer, would've saved a lot of time here ;)

Rodion (admin)     2015-07-28 19:57:08
User avatar

Hi! Thanks for your message - and sorry for I failed to respond in time :)

I'm glad you found the trouble. Note that for most tasks you can run them directly here in the web-interface so that output would be copied automatically.

>it would be a nice feature for CodeAbbey to point out the differences between expected answer and provided answer

Well, that is not too bad a suggestion. I promise to think how I can do this (bit difficult due to there could be answers of different types...)

Please login and solve 5 problems to be able to post at forum