lower(): all lower case letters.

my_str='Welcome to Plus2net'
output=my_str.lower()
print(output)                # welcome to plus2net

my_str='WELCOME TO PLUS2NET'
output=my_str.lower()
print(output)                # welcome to plus2net

my_str='welcome to plus2net'
output=my_str.lower()
print(output)                # welcome to plus2net

Handling Strings with Special Characters

When applying lower() to strings with numbers or special characters, only alphabetic characters are affected:

my_str = "Hello123!@#"
print(my_str.lower())  # Output: "hello123!@#"

Use Case: Normalizing User Input

When comparing user inputs, converting strings to lowercase ensures case-insensitive comparisons:

input_str = "Yes"
if input_str.lower() == 'yes':
    print("Input accepted.")
output
Input accepted.
All String methods upper() islower() isupper()


Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com







    Python Video Tutorials
    Python SQLite Video Tutorials
    Python MySQL Video Tutorials
    Python Tkinter Video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer