in and expanded on in their basic operation is straightforwardthough--as introduced in list comprehensions are way to build new list by applying an expression to each item in sequence (reallyin any iterable)and are close relatives to for loopsres [ for in 'spam'res ['ssss''pppp''aaaa''mmmm'list comprehensions this expression is functionally equivalent to for loop that builds up list of results manuallybut as we'll learn in later list comprehensions are simpler to code and likely faster to run todayres [for in 'spam'res append( res ['ssss''pppp''aaaa''mmmm'list comprehension equivalent as also introduced briefly in the map built-in function does similar workbut applies function to items in sequence and collects all the results in new listlist(map(abs[- - ])[ map function across sequence because we're not quite ready for the full iteration storywe'll postpone further details for nowbut watch for similar comprehension expression for dictionaries later in this indexingslicingand matrixes because lists are sequencesindexing and slicing work the same way for lists as they do for strings howeverthe result of indexing list is whatever type of object lives at the offset you specifywhile slicing list always returns new listl ['spam''spam''spam!' [ 'spam! [- 'spaml[ :['spam''spam!'offsets start at zero negativecount from the right slicing fetches sections one note herebecause you can nest lists and other object types within listsyou will sometimes need to string together index operations to go deeper into data structure for exampleone of the simplest ways to represent matrixes (multidimensional arraysin python is as lists with nested sublists here' basic two-dimensional list-based arraymatrix [[ ][ ][ ]lists in action