Python String islower() Method With Example

Python String islower

Now, we are going to learn about the islower method. As the name of the method says it all, we can use this method,  when we need to check if all the alphabets in the string are lowercase. So, If we are required to check whether or not, all the alphabets in the given string are in lowercase, we can make use of the islower method in this case. The method returns True if all the alphabets are in lowercase, and False otherwise. Let’s have a look at an example, where we are trying to demonstrate the same thing –

Python String islower() method

As you can see, in the string that we have here, all the alphabets are in lowercase. So, in this case, we are getting True as an output from the islower method. You can try playing with this method, for some other examples as well. Let’s say that in our string, there is at least one alphabet, which is uppercase. In such a situation, we get the returned value from the method as False. Let’s have a look at an example, which tries to demonstrate the same.

As you can see in the above program, we have the string, in which, we can see that not all the alphabets are in lowercase. In such a situation, the return value from the method is False. You can try executing the program and observing the output.

The thing is that if we are having some character other than the alphabet in the string, then also, it is not going to affect the output. Let’s have a look at the below example, which tries to demonstrate the same thing.

As you can see in the above program, we have a string, in which, there are some alphabets, which are all lowercase, and there are some numbers as well. The thing is that even if there are some characters that are not alphabets, the return value from the islower method is going to be True, since all the alphabets here, are in the lowercase.

So, as and when required, we can make use of the islower method, to check if all the alphabets in the string are lowercase or not. Remember that this method returns True or False, depending on whether all the alphabets in the string are in lowercase or not.