12.3.1 Sequences

You may have noticed that the word sequence has shown up quite a bit in our discussion on for-loops. In Python, a sequence is a compound data type consisting of several pieces of data in a particular order. So, in a way, you can think of a sequence as a sort of “super data-type” that describes several other compound data types. Strings are an example of a sequence because, in a string, the order of characters is important. “cat” and “tac” are not the same string, even though they contain the same letters. So, all strings are sequences. But not all sequences are strings, as we shall presently.