Credit Card Project

Hello there, i’m trying to do the project Credit Card !
i believe i achieved to complete the first function…
there is only one problem that is in one of the array provided, the credit card number just have 15 number, is that a bug or i need to find a solution to be able to do the provide the answer with cards with 16 number and 15 number;
here is my code the array with 15 number is the valid3;
Please Help me


The 15 digit card in valid3 isn’t a bug. Amex cards only have 15 digits, so you’ll need to adjust your solution to work with both. The same rules still apply though: the last digit is the check digit, etc.

So in that case i should not take out the last number?

It’s not about taking it out or not. You handle it like you handle a check digit already. The important thing to remember is that the check digit isn’t doubled.

Right now it looks like your algorithm tries to double the wrong digits if the length of the array is odd. That’s part of the challenge that you can deal with in a number of ways.

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.