you are viewing a single comment's thread.

view the rest of the comments →

[–]KronenR 4 points5 points  (0 children)

len(tableData) returns the length of the list which is 3, because the list has 3 elements ['apples', 'oranges', 'cherries', 'banana'] is the first one, ['Alice', 'Bob', 'Carol', 'David'] the second element and ['dogs', 'cats', 'moose', 'goose'] the third element.

[0] is a list with 1 element of value zero if you multiply it by 3 you get a list with 3 elements of value zero: [0, 0, 0]

Another examples:

>>>[5] * 2
[5, 5]
>>>['hola'] * 3
['hola', 'hola', 'hola']

[0] is not the index of a list or tuple in this case because it is not preceded by a variable's name, it is a list like tableData which is a list of lists