Index Variables

Practice with Index Variables

As we have seen in the previous section, we generally use an index variable to process the elements of a list. Below, we have reproduced the script that makes the character say the names of the players in a list.

Modify the script to make the character say the following:

  1. Every other name in a list.
  2. Every third name in a list.
  3. Names in a list in reverse order.
  4. Names in a list that start with the letter C.
  5. Names that are longer than four letters.