What is the function of negative index?



What is the function of negative index?..

Answer / chaitanya

The sequences in python are indexed and it consists of the positive as well as negative numbers. The numbers that are positive uses ‘0’ that is uses as first index and ‘1’ as the second index and the process goes on like that. The index for the negative number starts from ‘-1’ that represents the last index in the sequence and ‘-2’ as the penultimate index and the sequence carries forward like the positive number. The negative index is used to remove any new-line spaces from the string and allow the string to except the last character that is given as S[:-1]. The negative index is also used to show the index to represent the string in correct order.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

How does exception handling in python differ from java?

0 Answers  


What are static methods for?

0 Answers  


What is print in python?

0 Answers  


What is a function call or a callable object in python?

0 Answers  


Define the usage of split?

0 Answers  






How to walk through a list in a sorted order without sorting the actual list?

0 Answers  


What is the difference between args and kwargs?

0 Answers  


What is the difference between numpy and pandas?

0 Answers  


What are the different file-processing modes with python?

0 Answers  


Is there a reverse function in python?

0 Answers  


How do you create a project in python?

0 Answers  


which is the most commonly used package for data importing and manipulation?

0 Answers  


Categories