List methods (Python) Flashcards
1
Q
What does names.append(value) do
A
Adds an element to the end of the list
2
Q
What does names.extend(value) do
A
Adds several elements in the order given
3
Q
What does names.sort(value) do
A
Sorts the values in ascending order. If value is reverse = True then descending order
4
Q
What does names.count(value) do
A
Returns the number of times value shows up in the list
5
Q
What does names.index(value) do
A
Returns the index position of the value
6
Q
What does names.insert(i, value) do
A
Inserts value at position i
7
Q
What does names.remove(value) do
A
Removes the first instance of value
8
Q
What does names.remove(names[i]) do
A
Removes the element at position i
9
Q
What does del names[i]
A
Removes the names from element i