how python does negative indexing code example
Example 1: python negative indexing
list = ["Python", "Java", "C++", "Javascript", "SQL", "PHP"]
print(list[-1]) # "PHP"
print(list[-4]) # "C++"
print(list[:-3]) # ["Python", "Java", "C++"]
print(list[-2:]) # ["Javascript", "SQL", "PHP"]
print(list[-5:-2]) # ["Java", "C++", "Javascript"]
Example 2: negative indexing in python example
negative indexing on python example