Array Flashcards

1
Q

What is an Array?

A

An array is a special variable, which can hold more than one value at a time.

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

Access the Elements of an Array?

A

You refer to an array element by referring to the index number.

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

Get the value of the first array item:

A

x = cars[0]

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

Modify the value of the first array item:

A

cars[0] = “Toyota”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
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
6
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
7
Q

Returns a copy of the list

A

copy()

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

Returns the number of elements with the specified value

A

count()

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

Add the elements of a list (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
10
Q

Returns the index of the first element with the specified value

A

index()

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

Adds an element at the specified position

A

insert()

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

Removes the element at the specified position

A

pop()

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

Removes the first item with the specified value

A

remove()

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

Reverses the order of the list

A

reverse()

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

Sorts the list

A

sort()

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

Sort a list using a key

A

look this up biotch!