Answer Posted / 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 View All Answers
What is the difference between the shallow copy and deep copy in python?
What is the best notepad?
What can I build with python?
How to prevent blocking in content() method of socket?
What python frameworks do you know?
Which is better PHP or Python?
What is meant by mutex in python?
What are the disadvantages of using python?
Can dictionary have a duplicate keys ?
What is numpy? Is it better than a list?
How can you access a session in flask?
What is setuptools in python?
What are differences between list and dictionary in python?
What is split() function?
How to improve performance of this code?