Chapter 7 - Indexing and Slicing of Sequences Flashcards

1
Q

Sequence

A

Compound data type containing one or more pieces of data in a linear order

eg. String

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

Indexing

A

Operator of a sequence

Logging the position of each character in a sequence

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

Offset

A

Representation of a characters position in a sequence using an integer

offset = x-1

First position = 0

Use square brackets to access an item using its offset

Negative integers can be used to get the offset from the final character

eg. offset -2 is offset of the second last character

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

Slicing

A

Selecting zero or more items of a sequence and using them to form a new sequence

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