structured typesmutabilityand higher-order functions will print the list [ the for clause in list comprehension can be followed by one or more if and for statements that are applied to the values produced by the for clause these additional clauses modify the sequence of values generated by the first for clause and produce new sequence of valuesto which the operation associated with the comprehension is applied for examplethe code mixed [ ' ' print [ ** for in mixed if type( =intsquares the integers in mixedand then prints [ some python programmers use list comprehensions in marvelous and subtle ways that is not always great idea remember that somebody else may need to read your codeand "subtleis not usually desirable property functions as objects in pythonfunctions are first-class objects that means that they can be treated like objects of any other typee int or list they have typese the expression type(facthas the value they can appear in expressionse as the right-hand side of an assignment statement or as an argument to functionthey can be elements of listsetc using functions as arguments can be particularly convenient in conjunction with lists it allows style of coding called higher-order programming consider the code in figure def applytoeach(lf)"""assumes is listf function mutates by replacing each elementeof by ( )""for in range(len( )) [if( [ ] [ - print ' =' print 'apply abs to each element of applytoeach(labsprint ' =' print 'apply int to each element of' applytoeach(lintprint ' =' print 'apply factorial to each element of' applytoeach(lfactrprint ' =' print 'apply fibonnaci to each element of' applytoeach(lfibprint ' =' figure applying function to elements of list