Program
b="hari taraka prabhu welcome to python programming"
print("b is:",b)
print(" ")
#to upper
print("---------->>upper cse")
print("b.upper()" , b.upper())
print(" ")
#to lower
print("---------->>lower cse")
print("b.lower()" , b.lower())
print(" ")
a=" hari taraka prabhu welcome to python programming "
print("a is:",a)
print(" ")
#remove spaces
print("---------->>Remove white spaces")
print("a.strip()" , a.strip())
print(" ")
#remove left side spaces
print("---------->>lstrip")
print("a.lstrip()" , a.lstrip())
print(" ")
#remove right side spaces
print("---------->>rstrip")
print("a.rstrip()" , a.rstrip())
print(" ")
a="hari taraka prabhu welcome to python programming"
print("a is:",a)
print(" ")
#replace string
print("---------->>replace string")
print("a.replace is:", a.replace("a","AAA"))
print(" ")
print("a.replace is:", a.replace("prabhu","manyam manyam"))
print(" ")
#split string
print("---------->>split string")
print("a.split is:", a.split(" "))
print(" ")
Output:
b is: hari taraka prabhu welcome to python programming
---------->>upper cse
b.upper() HARI TARAKA PRABHU WELCOME TO PYTHON PROGRAMMING
---------->>lower cse
b.lower() hari taraka prabhu welcome to python programming
a is: hari taraka prabhu welcome to python programming
---------->>Remove white spaces
a.strip() hari taraka prabhu welcome to python programming
---------->>lstrip
a.lstrip() hari taraka prabhu welcome to python programming
---------->>rstrip
a.rstrip() hari taraka prabhu welcome to python programming
a is: hari taraka prabhu welcome to python programming
---------->>replace string
a.replace is: hAAAri tAAArAAAkAAA prAAAbhu welcome to python progrAAAmming
a.replace is: hari taraka manyam manyam welcome to python programming
---------->>split string
a.split is: ['hari', 'taraka', 'prabhu', 'welcome', 'to', 'python', 'programming']