Section 1.1 Multiplication Principle
The multiplication principle is more complicated than simply counting the number of items in a Cartesian product, but sometimes a Cartesian product is exactly what you need. Sage can do that.
Notice that we can put any number of constituent sets into a Python list (square brackets), and that each set is also specified as a Python list. We can ask for the size of this set, and we can enumerate all of its elements.
We can examine individual sandwiches by indexing into the list.
Yum. Check that this is the fifth sandwich in the list, since Python begins counting with zero. Notice too, that the parentheses indicate a Python tuple (a 3-tuple, or triple, in this case), which is very much like a Python list, except that it is immutable, meaning that you cannot change it. If you wanted to examine each sandwich in turn for some reason (say, to print it as part of a menu), then there are better ways than indexing into the list, as we will see in the next section.