Strings are compound data type made of sequence of characters. Hence from the string, the individual charters can also be directly accessed. Strings are created by using single quotes or double quotes or triple quotes. Example: >>>s1="Python Programming" >>>s2='Python Programs' >>>s3="""Python is a powerful Programming language""" This will create a string object s1, s2 and s3 using different forms. Individual characters can be accessed using different subscripts( +ve or –ve) with the string object. Example >>>s="Python" >>>s[0] ‘P’ >>>s[2] ‘t’ >>>s[5] ‘n’ >>>s[-1] ‘n’ >>>s[-3] ‘h’ >>>s[-6] ‘P’ We can also slice a string. Segment of a string is called a slice. >>>s[1:3] ‘yt’ If the first index is not mentioned, the slicing will start from 0. >>>s[:3] ‘Pyt’ >>>s[2:6] ‘thon’ If the l...
Python for ktu students-by Dr Binu V P-9847390760. This Blog is written using python 2.x. Visit the new blog pythonformlktuminor.blogpost.com for python 3.x