Python Forum

Full Version: How to apply function lower() to the list?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, everyone!
I have a list with the names of users:
users = ['Timoteusz', 'MAD', 'GaMer', 'ToXIC',....]
All the names are in different letter case.
How to apply function lower() to the copy of this list to make all the names lowercase? Huh
users = ['Timoteusz', 'MAD', 'GaMer', 'ToXIC']

# using list comprehension
users_lower = [item.lower() for item in users]

# using map
users_lower2 = list(map(str.lower, users))
print(users_lower)
print(users_lower2)
Thanks! Thumbs Up Super! It works!