Skip to main content

5 docs tagged with "Collections"

Lists, tuples, dictionaries, and sets.

View all tags

Data Types

Python's four scalar and four collection types—int, float, str, bool, list, tuple, dict, set—mutability, ordering, and hashability.

Dictionaries and Sets

Key/value lookup with dict, uniqueness and set algebra with set, and why keys must be immutable.

Lists

The mutable sequence — methods that change it in place, sort vs sorted, the reference trap, and comprehensions.

Strings and Slicing

Indexing, the three-part slice, immutability, and the string methods worth knowing.

Tuples

The immutable sequence — the trailing-comma rule, shallow immutability, unpacking, and when a tuple beats a list.