What is lower() in Python?

In Python, lower() is a built-in method used for string handling. The lower() method returns the lowercased string from the given string. It converts all uppercase characters to lowercase python. If no uppercase characters exist, it returns the original string. 

  1. It does not take any arguments, Therefore, It returns an error if a parameter is passed.
  2. Digits and symbols return are returned as it is, Only an uppercase letter is returned after converting to lowercase in Python.
Input: string = 'w3wiki'
Output: w3wiki

Syntax of lower()

Syntax: string.lower()

Parameters:

  • lower() does not take any parameters

Returns: It converts the given string in into lowercase and returns the string.

Examples

In this code we will use the lower() method to convert the strings to lowercase. Firstly we will take uppercase string”w3wiki” that is converted to lower case() with the help of string.lower() function. Same we will try with the string that contains both upper and lower case then function will convert this to lower case.

Python3




# Checking for lowercase characters
string = 'w3wiki' #Define a string that contains only uppercase.
print(string.lower()) #convert into lower case
  
string = 'w3wiki' #Define a string that contains noth uppercase and lowercase.
print(string.lower()) #convert into lower case.


Output:

w3wiki
w3wiki

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.

Similar Reads

What is isupper() in Python?

In Python, isupper() is a built-in method used for string handling. This method returns “True” if all characters in the string are uppercase, otherwise, returns “False”....

What is islower() in Python?

...

What is lower() in Python?

In Python, islower() is a built-in method used for string handling. The islower() method returns True if all characters in the string are lowercase, otherwise, returns “False”....

What is upper() in Python?

...

Count uppercase, lowercase letters, and spaces

In Python, lower() is a built-in method used for string handling. The lower() method returns the lowercased string from the given string. It converts all uppercase characters to lowercase python. If no uppercase characters exist, it returns the original string....