structured typesmutabilityand higher-order functions stringstuplesand lists we have looked at three different sequence typesstrtupleand list they are similar in that objects of all of these types can be operated upon as described in figure seq[ireturns the ith element in the sequence len(seqreturns the length of the sequence seq seq returns the concatenation of the two sequences seq returns sequence that repeats seq times seq[start:endreturns slice of the sequence in seq is true if is contained in the sequence and false otherwise not in seq is true if is not in the sequence and false otherwise for in seq iterates over the elements of the sequence figure common operations on sequence types some of their other similarities and differences are summarized in figure type type of elements examples of literals mutable str characters ''' ''abcno tuple any type ()( ,)('abc' no list any type [][ ]['abc' yes figure comparison of sequence types python programmers tend to use lists far more often than tuples since lists are mutablethey can be constructed incrementally during computation for examplethe following code incrementally builds list containing all of the even numbers in another list evenelems [for in lif % = evenelems append(eone advantage of tuples is that because they are immutablealiasing is never worry another advantage of their being immutable is that tuplesunlike listscan be used as keys in dictionariesas we will see in the next section since strings can contain only charactersthey are considerably less versatile than tuples or lists on the other handwhen you are working with string of characters there are many built-in methods that make life easy figure contains short descriptions of few of them keep in mind that since strings are immutable these all return values and have no side effect