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 = ["apple", "banana", "cherry"]
index = my_list.index("banana")
print(index)  # Output: 1
squared = [x**2 for x in range(5)]
print(squared)  # Output: [0, 1, 4, 9, 16]

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!