How do you return to lowercase in python?

The lower() method converts all uppercase characters in a string into lowercase characters and returns it.

Example

message = 'PYTHON IS FUN'

# convert message to lowercase print(message.lower())

# Output: python is fun


Syntax of String lower()

The syntax of lower() method is:

string.lower()

lower() Parameters()

lower() method doesn't take any parameters.


lower() Return value

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

If no uppercase characters exist, it returns the original string.


Example 1: Convert a string to lowercase

# example string
string = "THIS SHOULD BE LOWERCASE!"

print(string.lower())

# string with numbers # all alphabets should be lowercase string = "Th!s Sh0uLd B3 L0w3rCas3!"

print(string.lower())

Output

this should be lowercase!
th!s sh0uld b3 l0w3rcas3!

Example 2: How lower() is used in a program?

# first string
firstString = "PYTHON IS AWESOME!"

# second string
secondString = "PyThOn Is AwEsOmE!"

if(firstString.lower() == secondString.lower()):

print("The strings are same.") else: print("The strings are not same.")

Output

The strings are same.

Note: If you want to convert to uppercase string, use upper(). You can also use swapcase() to swap between lowercase to uppercase.

The Python lower() function converts a string to all lowercase. The Python isLower() method will check if the alphabetical characters in a string are all lowercase and return True or False. The lower() and isLower() functions are useful for fields like email where all letters should be lowercase.


When you’re working with a string in Python, you may want to convert the contents of that string to lowercase.

How do you return to lowercase in python?

Find Your Bootcamp Match

  • Career Karma matches you with top tech bootcamps
  • Access exclusive scholarships and prep courses

Select your interest
First name

Last name

Email

Phone number

By continuing you agree to our Terms of Service and Privacy Policy, and you consent to receive offers and opportunities from Career Karma by telephone, text message, and email.

For example, you may be creating a sign up form that converts a user’s email to lowercase. This is a common practice used to ensure that another account cannot be created using the same email in uppercase because strings are case-sensitive.

Python Lowercase

The Python built-in function lower() can be used to convert a string into lowercase and return a copy of the revised string. In addition, the Python isLower() method can be used to check whether all the characters within a string appear in lowercase.

In this tutorial, we will discuss how to use the lower() and isLower() methods to work with lowercase strings. We will explore examples for each of these methods to show how they can work in a Python program.

lower() Python Method

The Python lower() method converts all characters in a string to lowercase. Numbers and special characters are left unchanged. lower() is added to the end of a Python string value.

lower() is one of Python’s string methods. It works on all cased characters in a string. Here’s the syntax for the Python lower() function:

The lower() function takes in no parameters.

To show off how lower() works, we’ll use an example.

Lowercase Python Example

Let’s say that we are creating a sign up form, and we want to convert the email address a user inserts into lowercase. We could do so by using the following code:

email = input("What is your email address?")
print(email)

final_email = email.lower()
print(final_email)

Upon execution, our code returns the following strings:

What is your email address?


We declare a variable called email that collects an email address from the user. In this case, we inserted “” as our email. Then, we print out that email to the console in the format that it appeared when it was entered into the Python console.

On the next line, we declare a Python variable called final_email which converts the contents of the email variable to lowercase. Finally, we print final_email to the console, which returns our original string but in lowercase.

lower() will return symbols and numbers in their regular state because those characters are not case-sensitive. Only the Unicode characters in a string are converted to lowercase.

Python isLower()

The Python isLower() method evaluates whether all characters in a string are lowercase. This method does not check numbers, spaces, and other non-alphabetical characters.

Before you convert a string to lowercase, you may want to evaluate whether that string is already in lowercase. That’s where the isLower() method comes in.

isLower() returns a True or False value based on whether the string contains only lowercase characters. Here’s the syntax for the Python isLower() method:

Like the lower() method, isLower() does not take any parameters. Instead, it is appended to the end of a string value.

isLower() Python Example

Let’s use an example to showcase how the lower() method works. For instance, before we convert a user’s email to lowercase, we want to check if it is already in lowercase. We could do so using this code:

email = input("What is your email address?")

print(email.isLower())

If we run our program and insert the email “”, our code returns the following:

What is your email address?

False

The string “” contains one uppercase character—the L—and so the isLower() method decided that it was False. Meanwhile, if we were to insert the email “” into our program, we would receive the following output:

What is your email address?

True

isLower() will return True even if the string contains white space, digits, and/or symbols. Only lowercase letters that are found in the string will cause isLower() to evaluate it as False.

Say we want to run a particular block of code depending on whether a string contains an uppercase character. We could do this using a Python “if” statement.

Consider the following code:

if email.isLower():
	print("This email is valid.")
else:
	print("Email addresses can only contain lowercase characters.")

We use a Python if statement and the isLower() method to evaluate whether the user’s email only uses lowercase characters. If isLower() returns True, the “if” statement executes. Otherwise, our “else” statement executes.

If we inserted the email “”, our code would return:

Conclusion

The Python lower() method can be used to convert a string into lowercase and return a revised copy of the string. The Python isLower() function can be used to check whether a string contains an uppercase character.

How do you return to lowercase in python?

"Career Karma entered my life when I needed it most and quickly helped me match with a bootcamp. Two months after graduating, I found my dream job that aligned with my values and goals in life!"

Venus, Software Engineer at Rockbot

In this tutorial, we’ve explored the two main Python lowercase methods: lower() and isLower(). We also examined a few examples of these methods in action. So now you have the knowledge you need to work with lowercase strings like a Python expert!

If you’re interested in reading more about coding in Python, check out our complete How to Learn Python guide.

What is the lower () function in Python?

The lower() method returns a string where all characters are lower case. Symbols and Numbers are ignored.

How do you make a string lowercase?

JavaScript String toLowerCase() The toLowerCase() method converts a string to lowercase letters. The toLowerCase() method does not change the original string.

How do you change case in Python?

Let's see it in action:.
lower() This is analogous to the previous one: It converts a string into lowercase characters. ... .
capitalize() This function converts only the first character of the string to an uppercase letter and converts all the rest of the characters into lowercase:.
title() ... .
swapcase().

How do I print only lowercase in Python?

islower() is a more succinct way of checking the case of the letter. Similarly, . isupper() would print only the capital letters.