Solutions

Questions

  1. Answer: A script accesses the items in a list using the index number.
  2. Answer: They are numbered sequentially left to right starting with 0.
  3. Answer: A list can contain information like strings, int, and micropython.pin objects.
  4. Answer: Mutable means that a list can be changed after it is created.

Exercises

  1. Answer: Maria
  2. Answer: 4
  3. Answer: vlist[4] = '5'
  4. Answer: Use clist.append()
  5. Answer: It will return the index of the first instance of the word “snake” in the clist.

Project

Solution:

clist = [‘city1’, ‘city2’, ‘city3’, ‘city4’]

while True:
    for city in clist:
        print(‘city = ’, city)
        sleep(1000)
    print()