DeveloperBreeze

Convert Words to Uppercase in List Comprehension

# Define a list of words
words = ['hello', 'world', 'python']

# Use list comprehension to convert words to uppercase
uppercase_words = [word.upper() for word in words]

Related Posts

More content you might like

Cheatsheet
python

Python List Operations Cheatsheet

my_list = [3, 1, 4, 1, 5, 9]
sorted_list = sorted(my_list)
print(sorted_list)  # Output: [1, 1, 3, 4, 5, 9]
my_list = ["apple", "banana", "cherry"]
print("banana" in my_list)  # Output: True

Oct 24, 2024
Read More
Code
python

Generate List of Even Numbers Using List Comprehension

No preview available for this content.

Jan 26, 2024
Read More

Discussion 0

Please sign in to join the discussion.

No comments yet. Be the first to share your thoughts!