List Methods

 0    12 flashcards    sir
download mp3 print play test yourself
 
Question Answer
Adds an item to the end of the list.
start learning
. append()
Adds an item at the specified index.
start learning
. insert()
Removes the specified item.
start learning
. remove()
Removes the specified index, (or the last item if index is not specified).
start learning
. pop(i'index)
Keyword which, removes the specified index, whole list, variable or function.
start learning
del
Method which empties the list.
start learning
. clear()
You can make a copy of a list with the this method.
start learning
list2 = list1. copy()
Usethis method to add list2 at the end of list1.
start learning
list1. extend(list2)
Returns the index of the first element with the specified value
start learning
. index(value)
Reverses the order of the list.
start learning
. reverse()
Sorts the list.
start learning
list. sort(reverse=True|False, key=myFunc)
Returns the number of times a specified value occurs in a list.
start learning
. count()

You must sign in to write a comment