Do I need to include the start and end indexes in my backwards_by_tens slice?


#1

Question

Do I need to include the start and end indexes in my backwards_by_tens slice?

Answer

Nope! Since we want to continue going backwards through the to_one_hundred list until we reach the beginning, there’s no need to fill in the start or end indexes, just the stride.
Recall that writing my_list[::-1] will traverse through the entire list backwards.


FAQ: Learn Python - Advanced Topics in Python - Stride Length