1.

What is indexing in context to Python strings ? J Why is it also called two-way indexing ?

Answer»

In Python strings, each individual character is ! given a location number, called “index” and this process is called “indexing”. Python allocates indices in two directions :

1. in forward direction, the indexes are numbered as 0,1, 2, length-1. 

2. in backward direction, the indexes are numbered as -1, -2, -3,…. length. This is known as “two-way indexing”.



Discussion

No Comment Found