AppDividend
Latest Code Tutorials

Python String isupper islower upper lower Functions Example

0

Python String isupper() is an inbuilt function that returns “True” if all the characters in the string are uppercase.   Python String islower() is an inbuilt function that returns “True” if all the characters in the string are lowercase. These are the built-in method used for string handling.

Python String isupper islower upper lower

Python isupper() method returns “True” if all the characters in the string are uppercase; otherwise, It returns “False.”

Python islower() method returns “True” if all the characters in the string are lowercase; otherwise, it returns “False.”

Python upper() method returns the uppercased string from the given string. It converts all lowercase characters to the uppercase.

Python lower() method returns the lowercased string from the given string. It converts all uppercase characters to the lowercase.

Python String isupper() Method

The method isupper() checks whether all the case-based characters (letters) of the string are uppercase.

The syntax for the isupper() method is the following.

string.isupper()

See the following example.

# app.py

avengers = 'WE ARE IN THE ENDGAME NOW'
print(avengers.isupper())

See the output.

Python String isupper islower upper lower Functions Tutorial With Example

Now, let’s check another string.

# app.py

eddie = 'We are Venom'
print(eddie.isupper())

See the output.

Python String isupper() Method

The above string does not contain all the letters in uppercase; that is why it returns the false.

Python isupper() method returns “True” for whitespaces.

The isupper() method does not take any arguments; therefore, It returns an error if the parameter is passed.

The digits and symbols return “True,” only the uppercase letter returns “False.”

Python String islower() Method

The method islower() checks whether all the case-based characters (letters) of the string are lowercase.

The syntax for the Python islower() method is the following.

string.islower()

See the below example code.

# app.py

eddie = 'We are Venom'
print(eddie.islower())

See the output.

Python String islower() Method

The above string does not contain all the letters in the lowercase that is why it returns False. See another example code below.

# app.py

tony = 'i am ironman'
print(tony.islower())

See the output.

Python String islower() Example

Python islower() method returns “True” for whitespaces as well.

It does not take any arguments; therefore, It returns an error if the parameter is passed.

Digits and symbols return “True,” Only a lowercase letter returns “False.”

Python String upper() Method

Python String upper() method returns a copy of the string in which all case-based characters have been uppercased. It converts the string to the uppercase.

See the following syntax.

string.upper()

It does not take any argument. See the following example code.

# app.py

tony = 'i am ironman'
print(tony.upper())

See the output.

Python String upper() Method

Python upper() method does not take any arguments; therefore, It returns an error if the parameter is passed.

Digits and symbols return as it is, Only a lowercase letter is returned after converting to uppercase.

Python String lower() Method

Python String lower() method returns a copy of the string in which all case-based characters have been lowercased. It converts the string into the lowercased string. See the following syntax.

string.lower()

See the below code example.

# app.py

avengers = 'WE ARE IN THE ENDGAME NOW'
print(avengers.lower())

See the output.

Python String lower() Method Example

Python lower() method does not take any arguments; therefore, It returns an error if the parameter is passed.

Digits and symbols return returned as it is, Only an uppercase letter is returned after converting to lowercase.

Conclusively, Python String isupper islower upper lower Functions Tutorial With Example is over.

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.