1) Basic List Comprehension lis = [1, 2, 3, 4, 5]
new = [n**2 for n in lis]
# new = [1, 4, 9, 16, 25] Here, our list comprehension generates a new list containing the squares of each number in the original list lis. 2) List Comprehension With A Condition lis = [1, 2, 3, 4, 5]
new = [n**2…