capitalize() function in python by R4R Team

-capatalize() is a python string function which is used to capatilized the starting alphabet of the given string.

Example-
string is mytext
then it will become Mytext

string is sometimes
it will become Sometimes

string is program
it will become Program

program-

print("Enter any string")
s=input()
print("Original string is ",s)
print("String with first letter capital is ",s.capitalize())


output-

Enter any string
programming
Original string is programming
String with first letter capital is Programming

Enter any string
something
Original string is something
String with first letter capital is Something


-In this program, we take an input of string and show the original string then we use capitalize() function then show the string again to see the required output.


Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!