List comprehension is an efficient way to create lists. Convert the code below to list comprehension. After conversion, print the list.
square_list = []
for i in range(1, 10):
if i % 2 == 0:
square_list.append(i ** 2)List comprehension is an efficient way to create lists. Convert the code below to list comprehension. After conversion, print the list.
square_list = []
for i in range(1, 10):
if i % 2 == 0:
square_list.append(i ** 2)Create a free account to access the full topic