This chapter covers the following:
How data is stored in a string
Creating and displaying one- and two-dimensional arrays
List slicing and its methods
Creating tuples and searching for elements
Key/value pairs and their methods
Union, intersection, and difference operators
A sequence contains objects that are kept in a specific order. You can identify an object in a sequence by its index location. Also, you can extract from a sequence with the slicing operation. In this chapter you will look at three examples of sequences: lists, tuples, and strings.
Strings use quotes, such as
'Hello', "Hello", '"Hello"', """Hello""".
Lists use square brackets, such as
[Tiger, Coffee, 1,'a', 10.50, 'b'].
Tuples use parentheses, such as