+ 4

What are arbitrary indices ?

Can't understand the meaning of this term.

8th May 2017, 5:26 AM
Ekagra Sinha
Ekagra Sinha - avatar
2 Answers
+ 9
Go to the List Slices chapter in the Python tutorial. The comments at the fourth (4th) slide are explaining arbitrary or secondary indexing rather well. In short, arbitrary indexing is a way to refer to an element of, i.e. a string, by not using regular indexing. i.e. say you have a string blah = "ABCDE" blah[1] --> B blah[0] --> A blah[-1] --> E (-1 takes me to the end of the string) blah[-2] --> D and so on and so forth Other uses are in slicing. blah[1:]--> BCDE blah[1:3]--> BC blah[::-1] reverses the order of the string Check the comments in the slide mentioned above and if you need more info, let us know.
8th May 2017, 5:58 AM
Billy Tsouvalas
+ 1
@AG Hahaha.. Well, I shall not answer, thus enhancing the mystery..
9th May 2017, 10:01 AM
Billy Tsouvalas