+ 1
Luhn Formula - CC Validator
https://code.sololearn.com/cd7IZRSsbLNi/?ref=app It's passing 4/7 tests. When I test to print the sum, it's coming out wrong. For example, the first test case the sum should be a multiple of 10 to print valid, but it's coming out as 59.
5 Answers
+ 10
Anna Swann ,
there is a small issue in the second step of the calculation, where we should multiply each second digit by 2.
#for num in range(0, len(holder2), 2): # your code starts with the first digit
for num in range(1, len(holder2), 2): # this should work since it starts with the second digit
> scroll down in the task description to the bottom - have a look at the sample ...
+ 6
Lochard ,
> in the bottom of the app you can see the section *community*. click on it
> there you can find the *code coach*. in this section click on *view more*
> all the code coach exercises will be shown as an overview. use search bar on top, input *credit card*
> click on this item, then you will see the task description and also the code editor
+ 3
Thank you, Lothar! That worked!
+ 1
@Lothar May I ask how to see the task description?
0
I can see your code but I cannot see the question.
I looked up Luhn Formula, it seems quite different from your code.