Tuples and Lists
- So far we have worked with some basic python data types
- Most computer languages represent a sequence of times indexed by their position (like strings)
- Python has two other sequence structures:
- These sequences contain zero or more elements, unlike string each element can be of different type
- Why does python contain both lists and tuples?
- Tuples are immutable and lists are mutable
- Refer Here for the samples done
- Lists are good for keeping track of things by their order, especially when the order and contents might change
- Unlike tuples, lists are mutable, You can change list in place, add new elements, delete or replace existing elements
- Refer Here for the samples done in the class.