The Wayback Machine - https://web.archive.org/web/20250304093927/https://www.geeksforgeeks.org/python-string-lower/
Open In App

Python String lower() Method

Last Updated : 06 Nov, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Share
Report
News Follow

The lower() method in Python converts all uppercase letters in a string to their lowercase. This method does not alter non-letter characters (e.g., numbers, punctuation).

Let’s start with a simple example of lower() method:

Python
s = "HELLO, WORLD!"

# Change all uppercase letters to lowercase
res = s.lower()
print(res)

Output
hello, world!

Syntax of lower() method

string.lower()

Parameters

  • This method does not take any parameters.

Return Type

  • The lower() method returns a new string with all uppercase characters converted to lowercase. The original string remains unchanged since strings in Python are immutable.

Example of lower() method

Let’s take an example to illustrate how lower() method works on a string that includes non-alphabetic characters.

Python
s = "Hello, World! 123 @Python"

# Change only uppercase letters to lowercase
res = s.lower()
print(res)

Output
hello, world! 123 @python

Explanation: The lower() method converts all uppercase letters in a string to lowercase, while leaving numbers and special characters unchanged.

Practical applications of lower()

The lower() method is very useful in various scenarios, such as making case-insensitive comparisons between strings.

Example: Case-Insensitive Comparison

Python
s1 = "Python"
s2 = "python"

if s1.lower() == s2.lower():
    print("The strings are equal.")
else:
    print("The strings are not equal.")

Output
The strings are equal.

Explanation: In this example, we convert both s1 and s2 to lowercase using lower() before comparing them. This approach ensures that the comparison is not affected by case differences.

Frequently Asked Questions on lower() Method

What is lower() method in Python?

The lower() method is a built-in Python string method that converts all uppercase letters in a string to lowercase. It returns a new string and does not change the original string.

Does lower() modify the original string?

No, lower() returns a new string where all characters are lowercase, but the original string remains unchanged because strings in Python are immutable.

Does lower() affect non-alphabet characters?

No, lower() only converts uppercase letters to lowercase. Non-alphabet characters (such as numbers, punctuation, or symbols) remain unchanged.

What is return type of lower() method?

The return type is a str, specifically a new string in lowercase.


Level up your coding with DSA Python in 90 days! Master key algorithms, solve complex problems, and prepare for top tech interviews. Join the Three 90 Challenge—complete 90% of the course in 90 days and earn a 90% refund. Start your Python DSA journey today!


Next Article
Practice Tags :

Similar Reads

Python String Methods | Set 1 (find, rfind, startwith, endwith, islower, isupper, lower, upper, swapcase & title)
Some of the string basics have been covered in the below articles Strings Part-1 Strings Part-2 The important string methods will be discussed in this article1. find("string", beg, end) :- This function is used to find the position of the substring within a string.It takes 3 arguments, substring , starting index( by default 0) and ending index( by
4 min read
PyQt5 - lower() method for Labels
In PyQt5, when we create more than one label at same position they overlap each other such that the label which was made at last should be shown at top. Although, we can set the opaque level but sometimes some label have lower priority and that's why they should be at below level therefore, lower() method is used. Syntax : label.lower() Argument :
2 min read
numpy string operations | lower() function
numpy.core.defchararray.lower(arr) function is used to return an array with the elements converted to lowercase. Parameters: arr : [ array_like ] Input array which may be str or unicode. Returns : [ndarray] Output lowercased array of str or unicode, depending on input type. Code #1: Python3 # Python Program explaining # numpy.char.lower() function
1 min read
Python | Pandas Series.str.lower(), upper() and title()
Python is a great language for data analysis, primarily because of the fantastic ecosystem of data-centric Python packages. Pandas is one of those packages, making importing and analyzing data much easier. Python has some inbuilt methods to convert a string into a lower, upper, or Camel case. But these methods don't work on lists and other multi-st
4 min read
Python Program Integrate a Chebyshev Series and Set the Lower Bound of the Integral
The Chebyshev series has polynomials with the largest possible leading coefficient, whose absolute value on the interval [−1, 1] is bounded by 1. They are also the "extremal" polynomials. Chebyshev polynomials are significant in approximation theory because the roots of Tn(x), which are also called Chebyshev nodes, are used as matching points for o
3 min read
Higher-Lower Game with Python
In this article, we will be looking at the way to design a game in which the user has to guess which has a higher number of followers and it displays the scores. Game Play:The name of some Instagram accounts will be displayed, you have to guess which has a higher number of followers by typing in the name of that account. Make sure you type the name
8 min read
Integrate a Chebyshev series and set the lower bound of the integral using NumPy in Python
In this article, we will see how to integrate a Chebyshev series and set the lower bound of the integral in Python using Numpy. To perform Chebyshev integration, NumPy provides a function called chebyshev.chebint which can be used to integrate Legendre series. Syntax: chebyshev.chebint(c, lbnd=0, scl=1, axis=0) Parameters: c – Array of Chebyshev se
2 min read
Difference between casefold() and lower() in Python
In this article, we will learn the differences between casefold() and lower() in Python. The string lower() is an in-built method in Python language. It converts all uppercase letters in a string into lowercase and then returns the string. Whereas casefold() method is an advanced version of lower() method, it converts the uppercase letter to lowerc
2 min read
isupper(), islower(), lower(), upper() in Python and their applications
In this article, we will discuss isupper(), islower(), upper(), and lower() functions in Python. These methods are built-in methods used for handling strings. Before studying isupper(), islower(), upper(), and lower() in detail let's get a basic idea about them. What is isupper() in Python?In Python, isupper() is a built-in method used for string h
6 min read
Python program to count upper and lower case characters without using inbuilt functions
Given a string that contains both upper and lower case characters in it. The task is to count a number of upper and lower case characters in it. Examples :Input : Introduction to Python Output : Lower Case characters : 18 Upper case characters : 2 Input : Welcome to GeeksforGeeks Output : Lower Case characters : 19 Upper case characters: 3Method 1
3 min read