List Methods

 0    12 flashcards    sir
tải về mp3 In chơi tự kiểm tra
 
câu hỏi câu trả lời
Adds an item to the end of the list.
bắt đầu học
. append()
Adds an item at the specified index.
bắt đầu học
. insert()
Removes the specified item.
bắt đầu học
. remove()
Removes the specified index, (or the last item if index is not specified).
bắt đầu học
. pop(i'index)
Keyword which, removes the specified index, whole list, variable or function.
bắt đầu học
del
Method which empties the list.
bắt đầu học
. clear()
You can make a copy of a list with the this method.
bắt đầu học
list2 = list1. copy()
Usethis method to add list2 at the end of list1.
bắt đầu học
list1. extend(list2)
Returns the index of the first element with the specified value
bắt đầu học
. index(value)
Reverses the order of the list.
bắt đầu học
. reverse()
Sorts the list.
bắt đầu học
list. sort(reverse=True|False, key=myFunc)
Returns the number of times a specified value occurs in a list.
bắt đầu học
. count()

Bạn phải đăng nhập để đăng bình luận.