Computer Science
Write a program to convert a string with more than one word into titlecase string where string is passed as parameter. (Titlecase means that the first letter of each word is capitalized.)
Python
Python String Manipulation
6 Likes
Answer
s = input("Enter a string: ")
s1 = s.title()
print(s1)Output
Enter a string: python programming is fun
Python Programming Is Fun
Answered By
4 Likes
Related Questions
What will be the output of the following code?
Text = "Mind@Work!" ln = len(Text) nText = "" for i in range(0, ln): if Text[i].isupper(): nText = nText + Text[i].lower() elif Text[i].isalpha(): nText = nText + Text[i].upper() else: nText = nText + 'A' print(nText)Input the string 'My School'. Write a script to partition the string at the occurrence of letter 'h'.
Write a program that takes a sentence as an input parameter where each word in the sentence is separated by a space. The function should replace each blank with a hyphen and then return the modified sentence.
Write a script to partition the string 'INSTITUTE' at the occurrence of letter 'T'.