isupper(), islower(), lower(), upper() Methods

Uppercase Method

x.upper()

Example:

In [79]:
A = "WELCOME, let's learn new method "
In [80]:
# Make all the alphabets in A uppercase and put it into B

B = A.upper()
In [81]:
# Print B
B
Out[81]:
"WELCOME, LET'S LEARN NEW METHOD "

Lowercase Method

x.lower

Example:

In [82]:
C="WELCOME, LET'S LEARN NEW METHOD "
In [83]:
# Make all the alphabets in C lowercase and put it into D

D = C.lower()
In [84]:
# Print D

D
Out[84]:
"welcome, let's learn new method "

Let's find out wheter a string is uppercase or not

If it is uppercase the result is true

If it is not uppercase the result is false

x.isupper()

Example:

In [85]:
# Print A

A
Out[85]:
"WELCOME, let's learn new method "
In [86]:
# Check if all alphabets in A is uppercase

A.isupper()
Out[86]:
False

Example:

In [87]:
# Print B

B
Out[87]:
"WELCOME, LET'S LEARN NEW METHOD "
In [88]:
# Check if all alphabets in B is uppercase

B.isupper()
Out[88]:
True

Example:

In [89]:
# Print C

C
Out[89]:
"WELCOME, LET'S LEARN NEW METHOD "
In [90]:
# Check if all alphabets in C is uppercase

C.isupper()
Out[90]:
True

Example:

In [91]:
# Print D

D
Out[91]:
"welcome, let's learn new method "
In [92]:
# Check if all alphabets in D is uppercase

D.isupper()
Out[92]:
False

Let's find out wheter a string is lowercase or not

If it is lowercase the result is true

If it is not lowercase the result is false

x.islower()

Example:

In [93]:
# Print A

A
Out[93]:
"WELCOME, let's learn new method "
In [94]:
# Check if all alphabets in A is lowercase

A.islower()
Out[94]:
False

Example:

In [95]:
# Print B

B
Out[95]:
"WELCOME, LET'S LEARN NEW METHOD "
In [96]:
# Check if all alphabets in B is lowercase 

B.islower()
Out[96]:
False

Example:

In [97]:
# Print C

C
Out[97]:
"WELCOME, LET'S LEARN NEW METHOD "
In [98]:
# Check if all alphabets in B is lowercase

C.islower()
Out[98]:
False

Example:

In [99]:
# Print D

D
Out[99]:
"welcome, let's learn new method "
In [100]:
# Check if all alphabets in D is lowercase

D.islower()
Out[100]:
True