Chapter 7 Part 2 Flashcards

1
Q

Slice

A

A span of items that are taken from a sequence

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

Describe list[ : ]

A

list is what you want to slice followed the the start:end:step.

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

What is the in operator?

A

You use the in operator to determine whether an item is in a list.

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

list.append(item)

A

Used to add items to a list (added at the end of the list).

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

list.index(item)

A

Finds the item’s location in a list.

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

list.insert(index,item)

A

Used to insert something in a specific index location.

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

list.sort()

A

Sorts the elements of the list in ascending order.

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

list.remove(item)

A

Removes the first occurrence of an item.

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

list.reverse()

A

Reverses the order of the elements in a list.

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

del Statement

A

Removes an element from a specific index in a list.

del list[i]

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

min(list) and max(list) Functions

A

Built-in functions that returns the highest or lowest value in a sequence.

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

What are the two ways to copy a list?

A
  1. concatenate with a new list

2. create a loop that puts the elements of the list into a new list

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