Credit Card Validator problem | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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 Resposta
+ 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 šŸ‡®šŸ‡³