Chapter 8: Lists Flashcards

1
Q

A circumstance where two or more variables refer to the same object.

A

aliasing

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

A character or string used to indicate where a string should be split.

A

delimiter

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

One of the values in a list (or other sequence); also called items.

A

element

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

Having the same value.

A

equivalent

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

An integer value that indicates an element in a list.

A

index

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

Being the same object (which implies equivalence).

A

identical

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

A sequence of values.

A

list

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

The sequential accessing of each element in a list.

A

list traversal

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

A list that is an element of another list.

A

nested list

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

Something a variable can refer to. Has a type and a value.

A

object

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

the relationship between indices and elements
eg. in a list

A

mapping

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

error type when you try to read or write an element that doesn’t exist

A

IndexError

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

for loop function that iterates through the number of times specified by an integer

A

range()

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

operator to concatenate lists
creates a new list

A

+

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

operator to repeat a list n times
creates a new list

A

*

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

method to update multiple list elements at once
creates a new list

A

slice
nums[1:3] = [5,6]

17
Q

method to add one new element to end of list
modifies existing list

A

.append()

18
Q

method to add list with multiple new elements to end of list
modifies existing list

A

.extend([list])

19
Q

method to arrange list from lowest to highest

A

.sort()

20
Q

method that removes indexed element from list and returns value
default removes last element
modifies existing list

A

.pop()
eg. pop.(2)

21
Q

statement that takes element off of list based on index
returns None

A

del
eg. del t[1]
del t[1:5]

22
Q

function to take element off of list based on its value
returns None

A

remove
eg. remove(‘b’)

23
Q

function that returns accumulated value of list elements

A

sum()

24
Q

function that returns number of elements in list

A

len()

25
Q

function to convert a string to a list

A

list()

26
Q

function to convert a string into a list of words based on a delimiter.
default delimiter is a space

A

.split()

27
Q

string method that takes a list of strings and concatenates them together with a delimiter.
Method called on the delimiter and list passed as parameter

A

.join()

’ ‘.join(string_list)

28
Q

function that returns new list in order and leaves the original alone

A

sorted()