Write difference between lists and dictionaries.
Question :
Write difference between lists and dictionaries.
The difference between lists and dictionaries are:
(a) In dictionary, index value can be of any data type and is called key, but in list index value is an integer.
(b) No sequence operation such as slicing and concatenation be applied to dictionaries as dictionary is not a sequence. Since it is not maintained in any specific order, operation that depends on a specific order can not be used where as slicing and concatenation are applied on lists.
(c) List are sequential collections (ordered) and dictionaries are non-sequential collections (unordered).