'batspam[ 'ratspam[ 'elephant['cat''bat''rat''elephant'][ 'elephant'hellospam[ 'hellocat'the spam[ ate the spam[ 'the bat ate the cat notice that the expression 'hellospam[ evaluates to 'hello'catbecause spam[ evaluates to the string 'catthis expression in turn evaluates to the string value 'hellocatpython will give you an indexerror error message if you use an index that exceeds the number of values in your list value spam ['cat''bat''rat''elephant'spam[ traceback (most recent call last)file ""line in spam[ indexerrorlist index out of range indexes can be only integer valuesnot floats the following example will cause typeerror errorspam ['cat''bat''rat''elephant'spam[ 'batspam[ traceback (most recent call last)file ""line in spam[ typeerrorlist indices must be integers or slicesnot float spam[int( )'batlists can also contain other list values the values in these lists of lists can be accessed using multiple indexeslike sospam [['cat''bat'][ ]spam[ ['cat''bat'spam[ ][ 'batspam[ ][ lists