String manipulation

# String manipulation

str1 = input("Enter string : ")

print("Length of string = ", len(str1))

L = str1.split(" ")
print("Reverse words in a string : ")
L.reverse()
for wd in L:
print(wd, end=" ")

Ntimes = int(input("\nEnter number of times to display string : "))
print(str1*Ntimes)

print("Enter two strings : ")
str2 = input()
str3 = input()

print("Concatenation of given strings : ", (str2+str3))

Str1="South India"

idx = Str1.index("India")

print("String splice : ")
print(Str1[idx:])

No comments:

Post a Comment

Don't be a silent reader...
Leave your comments...

Anu