Skip to content

Latest commit

 

History

History
29 lines (23 loc) · 814 Bytes

File metadata and controls

29 lines (23 loc) · 814 Bytes

Module 027: Unpacking and Multiple Assignment

Phase: 3. Data Structures
Estimated Time: 1.5 hours
Milestone: No

Overview

Master unpacking and multiple assignment in Python — from basic tuple unpacking to extended unpacking with the * operator.

Topics

  • Tuple/list unpacking
  • Swapping variables
  • Extended unpacking with * (star)
  • _ for throwaway values
  • Unpacking in for loops
  • Unpacking function return values

Learning Objectives

  • Unpack sequences into individual variables
  • Swap variables in a single line
  • Use * for extended unpacking of remaining elements
  • Use _ to ignore values during unpacking
  • Unpack in for loops and function returns

Prerequisites

  • Modules 000–026

Next Module

Module 028: Copying Objects