String

Escape sequence 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

str1 = "hello"
str2 = "world"
result = str1 + str2
print(result)
""" output
helloworld"""

Indexing

image.png

str1 = "apna "
print(str1[4])
print(str1[1])
""" output
_"""#space is printed
""" output
a"""#space is printe

slicing