String examples all

 #get a charcter positions
x=[1,2,3,4,5]
print("given list is:",x)
print("x[0] value is :", x[0])
print("x[1] value is :", x[1])
print("x[4] value is :", x[4])
print("                ")

y="hello"
print("given string is:", y)
print("charter in y[1] postion is :", y[1])
print("                ")


z=["hello",2,5,["hari taraka"]]
print("z value is:", z)
print("z[0] value is :", z[0])
print("z[1] value is :", z[1])
print("z[3] value is :", z[3])
print("                ")

#positons 2 to 5
b="hello world"
print("b value is:",b)
print("b value from positons 2 to 5 is:", b[2:5])
print("                ")


#remove white spaces in left and right positions
m="   hari taraka prabhu manyam   "
print("m value is:",m)
print("after removing spaces in m is:", m.strip())
print("                ")


#return length of the string
k="python program langaue is open source"
print("k value is:",k)
print("lenght of k is:", len(k))
print("                ")


#convert to lower & upper case
l="HarI ManYam WelcomE"
print("l value is:",l)
print("lower case of l is:", l.lower())
print("upper case of l is:", l.upper())
print("                ")


#replacing charcters
p="welcome to mysql learing program langaue oppo"
print("p value is:",p)
print("replacing charcters in p :", p.replace("o","7777"))
print("                ")

#spliting
q="oppooppopoopoop"
print("q value is:",q)
print("splitting string in q where o is :", q.split("o"))
print("                ")



o/p:

given list is: [1, 2, 3, 4, 5]
x[0] value is : 1
x[1] value is : 2
x[4] value is : 5
                
given string is: hello
charter in y[1] postion is : e
                
z value is: ['hello', 2, 5, ['hari taraka']]
z[0] value is : hello
z[1] value is : 2
z[3] value is : ['hari taraka']
                
b value is: hello world
b value from positons 2 to 5 is: llo
                
m value is:    hari taraka prabhu manyam   
after removing spaces in m is: hari taraka prabhu manyam
                
k value is: python program langaue is open source
lenght of k is: 37
                
l value is: HarI ManYam WelcomE
lower case of l is: hari manyam welcome
upper case of l is: HARI MANYAM WELCOME
                
p value is: welcome to mysql learing program langaue oppo
replacing charcters in p : welc7777me t7777 mysql learing pr7777gram langaue 7777pp7777
                
q value is: oppooppopoopoop
splitting string in q where o is : ['', 'pp', '', 'pp', 'p', '', 'p', '', 'p']