How to convert a string str to lowercase characters?Astr.lower()Bstr.toLower()Cstr.toLowerCase()
Question
How to convert a string str to lowercase characters?Astr.lower()Bstr.toLower()Cstr.toLowerCase()
Solution 1
The correct way to convert a string to lowercase characters is by using the method A: str.lower(). Here are the steps:
-
Define your string. For example: str = "HELLO WORLD"
-
Use the .lower() method to convert all the characters in the string to lowercase. Like this: lower_str = str.lower()
-
Now, lower_str contains the lowercase version of str. You can print it to check: print(lower_str)
This will output: "hello world"
Solution 2
The correct way to convert a string to lowercase characters is by using the method A: str.lower(). Here are the steps:
-
Define your string. For example: str = "HELLO WORLD"
-
Use the .lower() method to convert all the characters in the string to lowercase. Like this: lower_str = str.lower()
-
Now, lower_str contains the lowercase version of str. You can print it to check: print(lower_str)
This will output: "hello world"
Similar Questions
How can you convert a lowercase character to uppercase manually in a string?
Write a program that converts strings of all uppercase characters into strings of all lowercase and viceversa
The output of executing string.ascii_letters can also be achieved by:string.ascii_lowercase_string.digitsstring.ascii_lowercase+string.ascii_upercase string.lettersstring.lowercase_string.upercase
What is the correct way to convert a string to uppercase in Java?Question 1Answera.toUpper()b.toUpperCase()c.uppercase()d.convertToUpperCase()
write a String function to make string "TUTEDUDE" to lowercase*
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.