I was wondering why negative indices in python are so
important - are there any applications? I could just use
my_list[len(my_list) -
1]
to find
the last element of my_list. Why do we need
class="lang-py
prettyprint-override">
my_list[-1]
To
find the last element?
EDIT:
It's not
that I don't understand what my_list[-1] means, I want to know
where this might be used.
No comments:
Post a Comment