Computer Science, asked by CHSURYASASIDHAR8092, 10 months ago

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

Answers

Answered by laraibmukhtar55
8

Indexing in context of python string and two way indexing:

• In Python strings, each separate character is assigned a location number, named “index” and this process is known as “indexing”.  

• Python assigns indices in 2 directions: 1. in forward direction; here 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 recognized as “two-way indexing”.

Hope it helped..

Answered by TeraBhaii
0

\large{\bullet{\underline{\tt{explanation:-}}}}

  • In python strings , each individual characters 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,1. ...length -1.
  2. In backward direction, the indexes are numbered as -1. This is known as two way indexing.
Similar questions