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]

Continue Reading

Discover more amazing content handpicked just for you

Cheatsheet
python

Python List Operations Cheatsheet

my_list = ["apple", "banana"]
my_list.insert(1, "cherry")
print(my_list)  # Output: ['apple', 'cherry', 'banana']
my_list = ["apple", "banana"]
my_list.extend(["cherry", "orange"])
print(my_list)  # Output: ['apple', 'banana', 'cherry', 'orange']

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. Start the discussion!