Manipulating lists Flashcards
1
Q
updating element in index 1 with value xxx
A
L[1]= xxx
2
Q
add one element xxx to end of list L (2 modi)
A
L2= L+ [xxx]
L.append (xxx)
3
Q
add one element xxx to start of list L
A
L2= [xxx] + L
4
Q
updating more than one element (two elements x and y) to indexes 1 and 3
A
L[ 1: 3 ]=[ x , y]
5
Q
add element xxx at specific index i
A
list.insert ( i , xxx )
6
Q
remove element in index i
A
del (L [i] )
7
Q
remove value xxx from list L
A
L . remove (xxx)
8
Q
copy list L
A
L2=L1.copy ()
9
Q
look for index of item xxx in L
A
L.index (xxx)