(continued from previous page[ ]the following list comprehension will transpose rows and columns[[row[ifor row in matrixfor in range( )[[ ][ ][ ][ ]as we saw in the previous sectionthe nested listcomp is evaluated in the context of the for that follows itso this example is equivalent totransposed [for in range( )transposed append([row[ifor row in matrix]transposed [[ ][ ][ ][ ]whichin turnis the same astransposed [for in range( )the following lines implement the nested listcomp transposed_row [for row in matrixtransposed_row append(row[ ]transposed append(transposed_rowtransposed [[ ][ ][ ][ ]in the real worldyou should prefer built-in functions to complex flow statements the zip(function would do great job for this use caselist(zip(*matrix)[( )( )( )( )see unpacking argument lists for details on the asterisk in this line the del statement there is way to remove an item from list given its index instead of its valuethe del statement this differs from the pop(method which returns value the del statement can also be used to remove slices from list or clear the entire list (which we did earlier by assignment of an empty list to the slicefor examplea [- del [ [ del [ : [ del [:(continues on next page the del statement