Similarity and Difference between List and String
☞ Similarities :
- Length
- Indexing and slicing
- Membership operators
- Concatenation and replication operators + and *
- Accessing individual elements using index number
☞ Differences :
- Storage : Lists are stored in memory exactly like strings, except that because some of their objects are larger than others. They store references at each index of single characters as in strings.
- Mutability : Strings are not mutable, while lists are. You cannot change individual elements of a string in place, but lists allow you to do so.