Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
a list is a structure that contains a series of values of any type.
if we have a list like [10, 20, 30, 40] the first element (as in all computer science) is an elemet #0
so we start counting from 0 not from 1 as in regular life.
if we need to get the first element of the array (list) we use
arr[0]
(arr
is a name of the array/list)when we iterate over the array using the
for
loop we get each consecutive element of that array with each loop.for i in data
means "take each element ofdata
one at a time".so at loop 0 we take the 0th element and write its value to the variable
i
here each element of the
data
list is a list itself, i.e. the 0th element is equal to [18, 20]so i[0] means 18 and i[1] means 20. if we try to get the 2nd element of the list
i
we would encounter an error because there is no 2nd element in this array/list.using words like 'key' and 'value' in this case is a bit wrong.
This comment is hidden because it contains spoiler information about the solution