Python String isupper islower upper lower: Complete Guide

Python String isupper() is a built-in function that returns “True” if all the characters in the string are uppercase. The String islower() is a built-in 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 uppercase.

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

Python isupper

Python isupper() is a built-in string function that checks whether all the string’s case-based characters (letters) are uppercase.

Syntax

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

string.isupper()

Example

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 islower

Python islower() is a built-in function that checks whether all the case-based characters (letters) of the string are lowercase.

Syntax

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 lowercase, which 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 upper

Python upper() is a built-in string method that returns a copy of the string in which all case-based characters have been uppercased. Then, it converts the string to uppercase.

Syntax

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 lower

Python lower() is a built-in string function that 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 as it is; only an uppercase letter is returned after converting to lowercase.

That’s it for this tutorial.

Leave a Comment

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