Array 6 Flashcards
Python has a set of built-in methods that you can use on
lists/arrays
Array methods
Adds an element at the end of the list
append()
Removes all the elements from the list
clear()
The _____method returns a copy of the specified list.
copy()
The ______method returns the number of elements with the specific value. The frequency of the element in the array.
count()
_____ return the number of times the value appears in the list
Count
The______ method adds the specified list elements (or any iterable) to the end of the current list.
extend()
The index() method returns the position at the _______ of the specified value.
first occurrence
The _____method removes the element at the specified position.
pop()
The remove() methods removes _______ of the element with the specified value.
first occurrence
The ______ method reverses the sorting order of the
elements.
reverse()
Syntax for sort()
Syntax: list.sort(reverse=True|False, key=myFunc)
The _____method sorts the list ascending by default.
You can also make a function to decide the sorting
criteria(s).
sort()