Tuples

16 articles
Interview Preparation Intermediate

11.16 Hands-on Exercises

Practice programs reinforcing Python tuple concepts -- combining concatenation and membership, the packing/unpacking swap idiom, a …

Jan 20, 2026 Read more
Interview Preparation Intermediate

11.15 Interview Questions

Frequently asked and scenario-based Python tuple interview questions covering tuple vs list, why (1) isn't a tuple, hashability, and classic …

Jan 20, 2026 Read more
Interview Preparation Beginner

11.14 Best Practices

When to reach for a tuple over a list, using unpacking to make multi-value returns and record access self-documenting, and a quick decision …

Jan 20, 2026 Read more
Interview Preparation Intermediate

11.13 Common Mistakes

The most common tuple bugs -- forgetting the trailing comma on a single-element tuple, trying to modify a tuple like a list, and being …

Jan 20, 2026 Read more
Interview Preparation Intermediate

11.12 Tuples in DevOps

Reading and writing tuples via plain text and CSV, plus five real infrastructure patterns where tuples are the right fit specifically …

Jan 20, 2026 Read more
Interview Preparation Intermediate

11.11 Common Algorithms

Searching, counting, and finding the max/min of a tuple use the exact same techniques as a list -- the only real difference is that a tuple …

Jan 20, 2026 Read more
Interview Preparation Intermediate

11.10 Performance

A direct tuple vs list comparison across memory, hashability, spare capacity, and method count -- and why creating a tuple literal is …

Jan 20, 2026 Read more
Interview Preparation Intermediate

11.9 Immutability and Copying

Why tuples are immutable by design, the concrete benefits that follow -- thread safety, hashability, communicated intent -- why a tuple …

Jan 20, 2026 Read more
Interview Preparation Intermediate

11.8 Nested Tuples

Creating and accessing nested tuples with chained indices, and why a tuple's immutability is shallow, not deep -- a mutable object held in …

Jan 20, 2026 Read more
Interview Preparation Beginner

11.6 Tuple Methods

Why a tuple has exactly two methods, count() and index(), and how that short list is a direct, mechanical consequence of immutability -- …

Jan 20, 2026 Read more
Interview Preparation Beginner

11.5 Tuple Operators

Concatenation and repetition always build a brand-new tuple since neither can mutate, membership testing with in, and lexicographic …

Jan 20, 2026 Read more
Interview Preparation Beginner

11.4 Tuple Packing and Unpacking

How comma-separated values automatically pack into a tuple, how assigning a tuple to several names unpacks it, the temp-variable-free swap …

Jan 20, 2026 Read more
Interview Preparation Beginner

11.3 Tuple Indexing and Slicing

Indexing and slicing rules identical to lists and strings, plus the one genuine difference: t[:] on a tuple returns the SAME object rather …

Jan 20, 2026 Read more
Interview Preparation Beginner

11.2 Creating Tuples

Empty tuples, why a single-element tuple requires a trailing comma, tuple literals, the tuple() constructor, and nested or mixed-type …

Jan 20, 2026 Read more
Interview Preparation Beginner

11.1 Introduction to Tuples

What a tuple is, its core characteristics, why immutability is a feature rather than a limitation, and how CPython allocates exactly enough …

Jan 20, 2026 Read more