# Learn to How to Work with Numbers and Strings by Implementing the Luhn Algorithm step 14

I figured out the answer to this one but I’m curious how this doesn’t work. I know we can’t give answers on here so if anyone could message me that would be great to help explain.

``````def verify_card_number(card_number):
sum_of_odd_digits = 0
card_number_reversed = card_number[16:0]
print(card_number_reversed)
``````

If 16 is the starting index and 0 is the last, then how does it not calculate backwards?

Can you please provide a link to the problem you are working on?

I’m sorry, I don’t have the link but its step 14 of the course listed in the topic title

Python string slicing accepts a starting position, ending position, and a step parameter. You would need to indicate -1 as the step parameter. However, when debugging this, I am noticing some strange issues. Let me link an article meanwhile which I found helpful. Python Slice String Article

I think the article will answer your question.

I see the logic, but it just doesn’t work that way.

A lot of the ways things work in programming are simply arbitrary. There’s a rationale for the design but at some point it just needs to work a certain way.

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