Week 2 Notes
Week 2 Notes
Access Method Via index Via iteration Via index Via index Via key
Performance Efficient for Fast Fast read-only Slower than Fast lookups
numerical membership access tuples for for keys
operations tests read-only
Key Differences:
• Array is used for homogeneously typed data (e.g., all integers or all floats).
• Set is used for unordered collections where uniqueness is important.
• Tuple is immutable and ordered, used for fixed collections of elements.
• List is mutable and ordered, suitable for general-purpose collections.
• Dictionary is used for mapping unique keys to values, ideal for lookups.