Q. What happens when from a string slice you skip the start and/or end values of the slice?


Answer =

Python will consider the limits of the string i.e. for missing start value, it will consider 0 (the first index) and for missing end value, it will consider length of the string.

For example:-

>>> a = “PYTHON”
>>> a [ : 4]
>>> PYTH
>>> a [2 : ]
>>> THON

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post