0

Credit Card Validator problem

I'm trying to do the Credit Card Validator code coach but I cannot pass tests 6 and 7. Apparently they are not valid but my code takes them as valid. My code takes the input from the user, reverses it, unpacks it, converts every character to an int and stores all the characters in a list, then it multiplies every second character by 2 and subtracts 9 if the result is greater than 9, and finally it checks if the sum of all numbers modulo 10 is 0 and the length is 16, and if any of them is false it prints "not valid". https://code.sololearn.com/c309c3WABsYn/?ref=app

18th Jul 2023, 11:20 AM
Tomás Gabriel Benítez
Tomás Gabriel Benítez - avatar
1 Odpowiedź
+ 3
If input is less than 16 length then your code generates error so that may be problem in your code i guess...
18th Jul 2023, 11:43 AM
Jayakrishna 🇮🇳