A string is a series of characters, they are mostly used to display text.
To define a string simply type text between quotes. Python accepts single, double and triple quotes.
Python Programming Bootcamp: Go from zero to hero
Python indexes the characters of a string, every index is associated with a unique character. For instance, the characters in the string ‘python’ have indices:
Characters in string
The 0th index is used for the first character of a string. Try the following:
Given a string s, the syntax for a slice is:
s[ startIndex : pastIndex ]
The startIndex is the start index of the string. pastIndex is one past the end of the slice.
If you omit the first index, the slice will start from the beginning. If you omit the last index, the slice will go to the end of the string. For instance: