Difference Between List Jtuple Jdictionary and Set
Difference Between List Jtuple Jdictionary and Set
The dictionary
The list can be The set can be
Tuple can be can be
represented by represented by
represented by ( ) represented by {
[] {}
}
The list allows Tuple allows The Set will not The dictionary
duplicate duplicate allow duplicate doesn’t allow
elements elements elements duplicate keys.
The list can use The set can use The dictionary
Tuple can use
nested among nested among can use nested
nested among all
all all among all
A setA
A list can be Tuple can be dictionary can A dictionary can
created using created using be created be created using
the list() functio the tuple() functio using the dict() functio
n n. the set() functio n.
n
A tuple is A set is
A list is mutable A dictionary is
immutable i.e we mutable i.e we
i.e we can make mutable, ut Keys
can not make any can make any
List Tuple Set Dictionary
Dictionary is
Set is
List is ordered Tuple is ordered ordered (Python
unordered
3.7 and above)