lower()
This method changes characters inside a string from upper to lower case. Symbols and numbers are ignored
Syntax
string.lower()
Example
str = 'PyTHon'
lower_case = str.lower()
print(lower_case)
Output
python
upper()
Converts a string into uppercase
Syntax
string.upper()
Exmaple
str = 'python programming'
upper_case = str.upper()
print(upper_case)
Output
PYTHON PROGRAMMING
capitalize()
This method will capitalize(uppercase) the first character in the string and the rest of the characters in lower case
Syntax
string.capitalize()
Example
str = 'python programming'
cap = str.capitalize()
print(cap)
Output
Python programming
Let see what happen if the first character in the string is number
str = '23 python programming'
cap = str.capitalize()
print(cap)
Output
23 python programming
islower()
This method return true if all characters are in lower case, otherwise false
Syntax
string.islower()
Example
str1 =' New york'
str2 = 'london'
str3 = 'Paris'
print(str1.islower())
print(str2.islower())
print(str3.islower())
Output
False
True
False