POEM = [ ' Yao ' , ' Yao ' , ' cold ' , ' mountain ' , ' channel ' ] Print (POEM [-2]) # listing negative index # slicing Print (POEM [. 1 :]) Print (POEM [2 :. 3:. 1 ]) Print (POEM [2:. 3 ]) Print (POEM [:: -. 1]) # flashback Print (POEM [:]) # a copy # modifications Print ( ' before modification: ' , POEM) # 1. Direct index POEM [0] = ' ah ' POEM [ . 4] = ' of He ' Print ( ' modified: ' , POEM) # 2. Modify by slicing Print ( ' slice before modification: ' , POEM) POEM [0: 2] = [ ' good ' , ' and ' ] # using the new element in place of the old elements poem [0: 2] = [ ' good ' , ' and ' , ' further ' ] # many elements inserted list poem [0:0]=[' Ha ' ] # to the index of the 0-insertion element Print ( ' sliced Review: ' , POEM) # delete del poem1 = [ ' off ' , ' off ' , ' to ' , ' warning ' , ' not ' ] del poem1 [0: 2] # deleted index position Print (poem1) del poem1 [:: 2] # deleted in steps 2 Print (poem1) # list traversal # traversed by the while loop lib = [ 'Luzi ' , ' HH ' , ' Dou ' , ' xixi ' , ' huhu ' ] I = 0 the while I < len (lib): Print (lib [I]) I + =. 1 # Loop through by for for S in lib : Print (S)