Oct 6, 2025
This lecture explains various string methods in Python used to change the case of text and check for case formatting.
upper()
Methodupper()
method converts all letters in a string to uppercase.string.upper()
"hello I am just preet".upper()
results in "HELLO I AM JUST PREET"
.lower()
Methodlower()
method converts all letters in a string to lowercase.string.lower()
"Hello I am just preet".lower()
results in "hello i am just preet"
.capitalize()
Methodcapitalize()
method returns a string with the first character uppercase and the rest lowercase.string.capitalize()
"maruti Suzuki".capitalize()
results in "Maruti suzuki"
.isupper()
Methodisupper()
method returns True
if all letters in the string are uppercase; otherwise, it returns False
.string.isupper()
"HELLO".isupper()
returns True
; "Hello friends".isupper()
returns False
.upper()
which returns a string.islower()
Methodislower()
method returns True
if all letters in the string are lowercase; otherwise, it returns False
.string.islower()
"hello".islower()
returns True
; "HELLO FRIENDS".islower()
returns False
.isupper()
method.True
or False
.upper()
, lower()
, capitalize()
, isupper()
, islower()
) in the Python interpreter.