2 ответов
+ 3
+ 2
List is a set of values accessible by index (ordinal number):
mylist = [1,2,'solo','learn', 4.57]
index starts with zero, so the first element of the list has index 0 and the last - list's lenght - 1:
>>> print(mylist[0])
1
Dicrtionary is a kind of set of pairs of key-value. Just think of it as of a common dictionary wich has word and it's definition. It means, that you can access each value by its key, not index.
>>> mydict = {1:'a', 'akey':'avalue', 'onemore':4.75}
>>> print(mydict['akey'])
avalue
You can add a value to a list just by appending it, but you need to add both key and value to add a value to a dictionary.
Both list and dictionary values could be lists themselves.