Build up a good understanding for tuples as a data structure and find use cases where it shines.
Tuples
Definition: Ordered, immutable, allows duplicates.
Syntax: my_tuple = (1, 2, 3)
Common operations & properties:
- Indexing:
my_tuple[1]
- Unpacking:
a, b, c = my_tuple
- Count:
my_tuple.count(2)
- Index:
my_tuple.index(3)
Build up a good understanding for tuples as a data structure and find use cases where it shines.
Tuples
Definition: Ordered, immutable, allows duplicates.
Syntax:
my_tuple = (1, 2, 3)Common operations & properties:
my_tuple[1]a, b, c = my_tuplemy_tuple.count(2)my_tuple.index(3)