lower() upper() & title() function in python

  • lower() Function in python converts the input string to lower case
  • upper() Function in python converts the input string to upper case
  • title() Function in python converts the input string to proper case or title case. that is, all words begin with uppercase and the rest are lowercase.

 

Syntax of lower() Function in python

str.lower()

Example of lower() Function in python

lower() Function in python converts the input string to lower case

str = "SALUTE to the Mother EARTH";
print str.lower()

so the output will be in lowercase as shown below.

salute to the mother earth

 

 

Syntax of upper() Function in python

str.upper()

Example of upper() Function in python

upper() Function in python converts the input string to upper case

str = "SALUTE to the Mother EARTH";
print str.upper()

so the output will be in uppercase as shown below.

SALUTE TO THE MOTHER EARTH

 

 

Syntax of title() Function in python

str.title()

Example of title() Function in python

  • title() Function in python converts the input string to Proper case or title case. i.e. , all words begin with uppercase and the rest are lowercase.
str = "SALUTE to the Mother EARTH";
print str.title()

so the output will be in proper case or title case as shown below.

Salute To The Mother Earth

 

 

previous lower() upper() & title() function in python                                                                                                                next lower() upper() & title() function in python