In Python, when one or more letters enclosed with in a single quote, double quote or triple quote, it is called a string data type represented by str class. In python there is no char data type. If we want to store a single letter, we have to use string data type. It is just like an array with starting index value zero. So individual characters can be accessed using the index number. The first character can be accessed by index number zero  and last character can be accessed using index number [-1]. Updation and deletion of characters from a string is not allowed because strings are immutable, but the complete string can be deleted using del keyword and can be reassigned a new value.
The below example demonstrates all the operations on String data type
# Creation of a string variable using single quote
x = 'Single Quote String'
# Creation of a string variable using double quote
x1 = "Double Quote String"
# Creation of a string variable using triple quote
x2 = ''' Triple Quote String'''
# Triple quote allows multiple lines
x2 = ''' Triple
quote string '''
# print first letter of string x
# print last letter of string x
# printing from index number 1 to 5th srl number letter using string slicing operator (:)
# Remember index number 1 means it is 2nd srl number letter.
del x # It is allowed but del x not allowed
print("Before updation ",x)
x1 = "Updated string"
print("After updation ",x)
Escape Sequences in a string.
If we want to use a single quote with in a string which is created using single quote or a double quote with in a string which is created using double, in that case we can use escape sequences. Escape character starts with a back slash (\). It means when ever python finds a back slash with in a string, it interprets it differently. If we intentionally want to print the back slash on the screen, means we want python to ignore back slash then we have to tell the interpreter that it is a raw string by placing a r or R before string.
# Escape Sequence
s1 = "Rabi Said \"he will come tomorrow\"\n"
# Raw string
s1 = r"Rabi Said \"he will come tomorrow\"\n"
My Self Subrat Dash. I have completed my MSc in Information Technology. Since last 12 years i am teaching Math and Computer at TTRC Computer Institute situated at Rayagada, Odisha, India.
I believe in conceptual learning, so i explain each and every concept with demos and examples, which makes it easier to understand.