operations are equivalent (though the first is easier to code and less easy to get wrong) [- 'ms[len( )- 'mthe last item in negative indexingthe hard way notice that we can use an arbitrary expression in the square bracketsnot just hardcoded number literal--anywhere that python expects valuewe can use literala variableor any expression we wish python' syntax is completely general this way in addition to simple positional indexingsequences also support more general form of indexing known as slicingwhich is way to extract an entire section (slicein single step for examples 'spams[ : 'paa -character string slice of from offsets through (not probably the easiest way to think of slices is that they are way to extract an entire column from string in single step their general formx[ : ]means "give me everything in from offset up to but not including offset the result is returned in new object the second of the preceding operationsfor instancegives us all the characters in string from offsets through (that is through as new string the effect is to slice or "parse outthe two characters in the middle in slicethe left bound defaults to zeroand the right bound defaults to the length of the sequence being sliced this leads to some common usage variationss[ :'pams 'spams[ : 'spas[: 'spas[:- 'spas[:'spameverything past the first ( :len( ) itself hasn' changed everything but the last same as [ : everything but the last againbut simpler ( :- all of as top-level copy ( :len( )note in the second-to-last command how negative offsets can be used to give bounds for slicestooand how the last operation effectively copies the entire string as you'll learn laterthere is no reason to copy stringbut this form can be useful for sequences like lists finallyas sequencesstrings also support concatenation with the plus sign (joining two strings into new stringand repetition (making new string by repeating another) 'spam introducing python object types