Uppercase string () in Python



Syntax :

  string_name  .capitalize ()  string_name : It is the name of string of whose first character we want to capitalize. 

Parameter: The capitalize () function takes no parameters.

Returned value: The capitalize () function returns the string with the capitalize character.

Below is a python program to illustrate the capitalize () function:

# Python program for demonstration
# using the capitalize () function

 
# capital () first letter
# string.

name = "geeks for geeks"

 

print (name.capitalize ()) 

 
< code class = "comments"> # demonstrating individual words
# using capital letters in case of a camel

name1 = " geeks "

name2 = "for"

name3 = "geeks"

print (name1.capitalize () + name2.capitalize ()

+ name3.capitalize ())

Output:

 Geeks for geeks GeeksForGeeks