Q. What is indexing in context to Python strings? 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:
* in forward direction, the indexes are numbered as 0, 1, 2 ... length-1.
* in backward direction, the indexes are numbered as -1, -2, -3.... length.
This is known as two-way indexing.
what about the answer for the second part of question that why it is called two way indexing
ReplyDelete!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Please read the whole answer again.
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )