What is the meaning of ( index in index:value )?

I think it isn’t the same meaning as the index number.

And I don’t understand this: I think there is no relation between the index number and dictionary


Thanks

It does have the same meaning as the index number - it is a quantity used to index something. For a list, we have numbers as the index. For a dictionary, we can have numbers or strings as the index.

The index as stated in the content you shared, also known as a key for a dictionary, is still used to refer to a particular value.

For example, in a simple list -

a = [4, 5]

We know that at index 0, the value is 4.

Similarly, in the dictionary -

a = {"4+": 10, "10+":13}

The value 13 corresponds to the index 10+. If we ever wanted to get the value for when the ratings where 10+ we can access that value using that index.

1 Like

Thanks a lot for the clarification.