Luhn Algorithm odd and even digits

I could be wrong but I noticed that this exercise has a slight error in the counting:
odd_digits = card_number_reversed[::2] would return index: 0,2,4…
and
even_digits = card_number_reversed[1::2] would return index: 1,3,5…
Not actively detrimental to code but confusing for users

Wouldn’t that mean you are getting: first, third, fifth… digit for the odd, and second, fourth, sixth… digit for the even?

1 Like

Or am I getting the 0th digit? :stuck_out_tongue:

2 Likes

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