Q. Define String Slicing.


Answer:-

A sub-part or a slice of a string, say s, can be obtained using s [n: m] where n and m are integers. Python returns all the characters at indices n, n+1, n+2...m-1

For example:-

>>>a = 'Well done'
>>>a [1:6]
'ell d'

Post a Comment

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

Previous Post Next Post