In: Computer Science
preform a piece of python code that focuses on string operations, thank you.
rstring = "Python Language"
print(len(rstring)) #Calculates the length of the string
print(rstring.index("n")) #This will print location of first
Occurence of letter n
print(rstring.count("n")) #This will print no of times letter n
appeared in the string
print(rstring[7:15]) #This will print the string from 7th location
till 15th location
print(rstring.upper()) #This will convert string into uppercase and
print it
print(rstring.lower()) #This will convert string into lowercase and
print it
print(rstring.split(" ")) #This will split the string into bunch of
strings grouped together in a list
Code Screenshot:-
Output:-