lower = ['a', 'b', 'c']
upper = [i.upper() for i in lower]
print(upper)
['A', 'B', 'C']
List comprehension is commonly used when we want to convert one sequence into another. In the above example, we convert the lower list/sequence of letters into a list of uppercase letters. The list comprehension is happening in line 2.
Python Mega Course: Learn Python in 60 Days, Build 20 Apps
Learn Python on Udemy completely in 60 days or less by building 20 real-world applications from web development to data science.