1.

What are negative indexes and why are they used?

Answer»
  • Negative indexes are the indexes from the END of the LIST or tuple or string.
  • Arr[-1] MEANS the last ELEMENT of array Arr[]
arr = [1, 2, 3, 4, 5, 6]#get the last elementprint(arr[-1]) #output 6#get the second last elementprint(arr[-2]) #output 5


Discussion

No Comment Found