String
- string is a datatype that stores a sequence of character
Escape sequence character
- backslash n \n is the escape sequence character
- backslash tab \t is for giving space
- esc is only used on character
Program for escape sequence character
# escape sequence character
a = "hello louday\\n hello"
b = 20
print(a,b)
#output
"""hello louday
hello 20"""
basic operation
- concatenation
- ex “Hello” + ”world” —> “hello world”
str1 = "hello"
str2 = "world"
result = str1 + str2
print(result)
""" output
helloworld"""
Indexing

- indexing helps to access the character
- Indexing starts form 0]
- Indexing modification cannot be done
str1 = "apna "
print(str1[4])
print(str1[1])
""" output
_"""#space is printed
""" output
a"""#space is printe
slicing