python list comprehension and statement code example
Example: list comprehension in python
Squaring List elements:
By loop:
lst = [1, 2, 3]
l =[]
for i in lst:
lst.append(i*i)
print(l)
By List Comprehension:
lst = [1, 2, 3]
l = [x*x for x in lst]
print(l)