M&C1: Confusing the index and the content

When students first encounter lists, they sometimes believe that there is some direct connection between the index number and the value held at the index position in the list. For students who have seen in a Physics or Chemistry course the use of variable subscripts, a connection between the index of an element in the data structure and the subscript may be a good way to reduce confusion.

In Scratch, most students will avoid making this mistake simply because the programmer can choose to display the data structure on the stage.

Using lists in Python provides a better demonstration of why this misconception may occur. One strategy helping students is to utilize PythonTutor to demonstrate the initialization of a list.


myData = [0, 0, 0, 0, 0]

myData[1] = 4

myData[4] = 3

Observe that the value 4 assigned to the list element at position 1 (myData[1]) is different from the index 4 used to access the 5-th element in the list. The video provides further explanation. Video Length: 0:52