This are a lot of lines but they are very repetitive, lots of the same thing.
The comment tells you that this a string array and all the words are the products in the store. You can see each item may be several words in '' quote marks. The words are separated by , commas.
snippet 2
#prints out each product in the array
print(productList[0])
print(productList[1])
print(productList[2])
...
...
print(productList[148])
print(productList[149])
print('\n')
In this snippet the comment tells you that the code displays all the products from the array.
The first display statement is
print(productList[0])
and when you compare that to the output you see first in the list is:
Juice - Happy Planet
Now look at the set up for the array and you see it begins with
productList = ['Juice - Happy Planet',
Is that what you would expect? Can you explain what is going on here from the code?
Juice - Happy Planet is stored first position in the productList array
First position in the array is productList[0] since array positions start counting from 0.
So print(productList[0]) goes to the first position in the array and finds what was stored there; Juice - Happy Planet
The last display statement is
print(productList[149])
and when you compare that to the output you see last in the list is:
Pea - Snow
Now look at the set up for the array and you see it ends with
... , 'Pea - Snow' ]
You can that the long list of display statements are going through the array element positions from 0 to 149, one by one and outputting the product stored in the array element at that position. This is called traversing the array, like the mail delivery person walking along the street from the first house to last.
0-149, how many elements is that?
150, so there are 150 elements in the array, positions 0-149.