To know about the list comprehension
concept in python3.
As list comprehension returns list, theyconsists of brackets containing the expression which needs to be executed for eachelement along with the for loop to iterate over each element.
List comprehensions are used forcreating new list from another iterables.
[expression for loop one_or_more conditions]
#simple list
list1=[2,4,5,7]
print(“old list is\n”,list1)
#list comprehension
new_list1=[i*i for i in list1]
#printing new list
print(“New list is”)
print(new_list1)