Array 6 Flashcards

1
Q

Python has a set of built-in methods that you can use on
lists/arrays

A

Array methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Adds an element at the end of the list

A

append()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Removes all the elements from the list

A

clear()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The _____method returns a copy of the specified list.

A

copy()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The ______method returns the number of elements with the specific value. The frequency of the element in the array.

A

count()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

_____ return the number of times the value appears in the list

A

Count

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

The______ method adds the specified list elements (or any iterable) to the end of the current list.

A

extend()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

The index() method returns the position at the _______ of the specified value.

A

first occurrence

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

The _____method removes the element at the specified position.

A

pop()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

The remove() methods removes _______ of the element with the specified value.

A

first occurrence

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

The ______ method reverses the sorting order of the
elements.

A

reverse()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Syntax for sort()

A

Syntax: list.sort(reverse=True|False, key=myFunc)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

The _____method sorts the list ascending by default.
You can also make a function to decide the sorting
criteria(s).

A

sort()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly