operators and expressions all sequences can be unpacked into sequence of variable names for exampleitems , , items letters "abcx, , letters ' ' ' ' 'cdatetime (( )( "am")(month,day,year),(hour,minute,am_pmdatetime when unpacking values into variablesthe number of variables must exactly match the number of items in the sequence in additionthe structure of the variables must match that of the sequence for examplethe last line of the example unpacks values into six variablesorganized into two -tupleswhich is the structure of the sequence on the right unpacking sequences into variables works with any kind of sequenceincluding those created by iterators and generators the indexing operator [nreturns the nth object from sequence in which [ is the first object negative indices can be used to fetch characters from the end of sequence for examples[- returns the last item otherwiseattempts to access elements that are out of range result in an indexerror exception the slicing operator [ :jextracts subsequence from consisting of the elements with index kwhere < both and must be integers or long integers if the starting or ending index is omittedthe beginning or end of the sequence is assumedrespectively negative indices are allowed and assumed to be relative to the end of the sequence if or is out of rangethey're assumed to refer to the beginning or end of sequencedepending on whether their value refers to an element before the first item or after the last itemrespectively the slicing operator may be given an optional strides[ : :stride]that causes the slice to skip elements howeverthe behavior is somewhat more subtle if stride is suppliedi is the starting indexj is the ending indexand the produced subsequence is the elements [ ] [ +stride] [ + *stride]and so forth until index is reached (which is not includedthe stride may also be negative if the starting index is omittedit is set to the beginning of the sequence if stride is positive or the end of the sequence if stride is negative if the ending index is omittedit is set to the end of the sequence if stride is positive or the beginning of the sequence if stride is negative here are some examplesa [ [:: [::- [ : : [ : :- [: : [: :- [ :: [ ::- [ : :- [ [ [ , [ , , [ , , , , [ , , , [ , , , , [ , , , , , [ , , , , the in operator tests to see whether the object is in the sequence and returns true or false similarlythe not in operator tests whether is not in the sequence for stringsthe in and not in operators accept subtrings for examplef lib fl ff