Skip to content

Latest commit

 

History

History
30 lines (24 loc) · 962 Bytes

File metadata and controls

30 lines (24 loc) · 962 Bytes

Module 021: Tuples

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

Overview

Learn about tuples, an immutable sequence type in Python. Understand when and why to use tuples instead of lists, and master tuple unpacking.

Topics

  • Creating tuples with () and the tuple() constructor
  • Immutability vs lists
  • Indexing and slicing tuples
  • When to use tuples (returning multiple values, dictionary keys)
  • Tuple unpacking basics
  • namedtuple (brief introduction)

Learning Objectives

  • Create tuples using parentheses and the tuple() constructor
  • Explain how immutability affects tuple usage
  • Index and slice tuples like lists
  • Choose tuples over lists for appropriate use cases
  • Unpack tuples into individual variables
  • Create and use namedtuple for readable data containers

Prerequisites

  • Modules 000–020 (all fundamentals, lists, strings)

Next Module

Module 022: Sets