List one similarity and difference between list and dictionary | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

List one similarity and difference between list and dictionary

python

7th Aug 2018, 1:18 PM
Worthy Panmei
3 Answers
+ 6
Lists: are indexed; ordered; can store duplicated elements. Dictionaries: store key-value pairs; the keys must be unique; the values are accessed via the keys; are unordered.
7th Aug 2018, 1:49 PM
Eduardo Petry
Eduardo Petry - avatar
+ 4
In list we access the values using index.but in dictionary we access the value by using key.remember that dictionary is faster than list. because in list we check the values O(n) values but in dictionary it is check by O(1)
7th Aug 2018, 4:46 PM
Maninder $ingh
Maninder $ingh - avatar