Learnerslesson
   JAVA   
  SPRING  
  SPRINGBOOT  
 HIBERNATE 
  HADOOP  
   HIVE   
   ALGORITHMS   
   PYTHON   
   GO   
   KOTLIN   
   C#   
   RUBY   
   C++   




isupper( ) FUNCTION


isupper( ) Function


The isupper( ) Function is used to check if all the letters in the String are of upper case.


Example :


x = "Hello World"
if x.isupper():
    print("All the letters in the String are in upper case")
else:
    print("Not all the letters in the String are in upper case")


Output :



  Not all the letters of the String are in upper case

In the above code, we have declared a String 'Hello World'.


x = "Hello World"

java_Collections

So, to check, if all the letters in the String are of upper case, we have used 'isupper( )' function.


if x.isupper():
    print("All the letters in the String are in upper case")
else:
    print("Not all the letters in the String are in upper case")

And in this case, other than 'H' and 'W' in the String 'Hello World' all the other letters in the String are in lower case. So, we got the below output.


Not all the letters of the String are in upper case

Similarly, let us look at the next example.


Example :


x = "HELLO WORLD"
if x.isupper():
    print("All the letters of the String are in upper case")
else:
    print("Not all the letters of the String are in upper case")


Output :



  All the letters of the String are in upper case

In the above code, we have declared a String 'HELLO WORLD'.


x = "HELLO WORLD"

java_Collections

Similarly, to check, if all the letters in the String are of upper case, we have used 'isupper( )' function.


if x.isupper():
    print("All the letters of the String are in upper case")
else:
    print("Not all the letters of the String are in upper case")

And in this case, all the letters in the String 'HELLO WORLD' are in upper case. So, we got the below output.


All the letters of the String are in upper case