Tuples are immutable sequence Types that can contain any data type. Tuples are iterable, and elements within tuples can be accessed via bracket notation, using a zero-based index from the left, or -1 from the right. Other Common Sequence Operations can also be used when working with tuples.
- Remember: tuples allow access via index, using brackets. Indexes start from the left at zero.
- Check
class tuple
for more details on tuples. - Check
class str
for more details on strings.
- What methods could be used here for for testing membership?.
- Check
class tuple
for more details on tuples. - Could you re-use your
convert_coordinate()
function?
- Remember that tuples support all common sequence operations.
- Could you re-use your
compare_records()
function here?
- Remember: tuples are immutable, but the contents can be accessed via index using bracket notation.
- Tuples don't have to use parentheses unless there is ambiguity.
- Python has multiple methods of string formatting.
str.format()
andf-strings
are two very common ones. - There are multiple textual formatting options available via Pythons
format specification mini-language
.