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.

string is mytext
then it will become Mytext

string is sometimes
it will become Sometimes

string is program
it will become Program


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


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

Enter any string
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:
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on 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!