common and very intuitive way to create lists from expressions is using list comprehensions this allows us to create list by writing an expression directly into the listfor examplelist comprehensions can be quite flexiblefor exampleconsider the following code it essentially shows two different ways to performs function compositionwhere we apply one function ( to another ( the following code prints out two lists representing the function composition of and calculated first using for loop and then using list comprehensiondef ( )return * def ( )return * lst [for in range( )lst append( ( ( ))print(lstprint([ (xfor in range( if in [ (jfor in range( )]]the first line of output is from the for loop construct the second is from the list comprehension expression