SigmaAnalytics & Tech
A7PythonBeginnerAbout 120 min to complete

Lists

Command of Python's most-used container — and the aliasing traps that Notebook 04's memory model predicts.

Notebook

About 120 minutes to complete

Enrol to read the notebook and download it to run.

What this module covers

Command of Python's most-used container — and the aliasing traps that Notebook 04's memory model predicts.

By the end of it

  • Create lists literally, from other iterables, and with comprehensions
  • Index, slice, and assign to slices — including deleting and replacing ranges
  • Apply every core list method and predict which mutate versus return
  • Distinguish .sort() from sorted(), and sort by custom keys and multiple fields
  • Write list comprehensions fluently, with conditions and nesting, and know when not to
  • Use enumerate(), zip(), and unpacking to write loops that read cleanly
  • Explain and avoid the three classic reference bugs: aliasing, [[0]3]3, and mutable
  • Choose between shallow .copy() and copy.deepcopy() correctly