0
What's the difference between a list and a dictionary?
3 Respostas
+ 4
list is a collection of data(elements ) where as dictionary is collection of key,value pair.
for ex: list = [1, 2,3,4,5]
dict = {'name': 'Pradeep' ,'age': 27}
+ 3
Basic difference is index ,to recall any value from list we use index (list[index]) this index is predefined integer numbers and start from 0 to onwards while in dictionary instead of index there is a key. key is programmer defined unique (any data type like string,int,float) value and in dictionary we use key to recall data
+ 1
list can be sorted or reversed. Dict cannot.