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
2
Q
Indexing
A
Operator of a sequence
Logging the position of each character in a sequence
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
4
Q
Slicing
A
Selecting zero or more items of a sequence and using them to form a new sequence