String manipulation is a process of manipulating the string, such as slicing, parsing, analyzing, etc. String slicing in python programming is all about fetching a substring from a given string by slicing it from a start to end index.
Syntax :
s [ start : end ]
s [ start : ]
s [ : end ]
s [ : : ]
This program is using the concept of slicing in python, which allows you to extract a portion of a string by specifying a range of indices.
The following operations are performed in the above code:
# String Manipulation ''' S a m p l e 0 1 2 3 4 5 -6 -5 -4 -3 -2 -1 ''' s = "sample" print(s) print(s[0:2]) print(s[:5]) print(s[1:]) print(s[-1]) print(s[-2:-1]) print(s[:-1]) print(s[::-1])To download raw file Click Here
sample sa sampl ample e l sampl elpmas
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions