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 |
Which is faster python or php?
Is python numpy better than lists?
Which python library would you prefer to use for data munging?
What are python iterators?
Can I learn python on my own?
Is python strongly typed?
What is type conversion in python?
What is blob in python?
What is enumerate() function in python?
What are Python modules? Name a few Python built-in modules that are often used.
Explain polymorphism in Python.
Is del the same as remove()? What are they?