CP Python List Tuple Sets and Dictionary
CP Python List Tuple Sets and Dictionary
Programming
Differences between list , tuple, set &
dictionary
List
• Lists are one of the most commonly used data structures provided by
python; they are a collection of iterable , mutable and ordered data. They
can contain duplicate data.
• The list can be represented by []
Example:-
• Output:-
Tuple
• Tuples are similar to lists. This collection also has iterable, ordered, and
(can contain) repetitive data, just like lists. But unlike lists, tuples are
immutable.
• Tuple can be represented by ().
• example:-
output:-
Set
• Set is another data structure that holds a collection of unordered, iterable
and mutable data. But it only contains unique elements.
• Set can be represented by {}.
example:-
output:-
Dictionary
• Dictionaries are used to store data values in key : value
pairs.
• A dictionary is a collection which is ordered, changeable
and do not allow duplicates.
• The dictionary can be represented by {}.
output:-
Collection VS
Mutable Ordered Indexing Duplicate Data
Features
List
Tuple 𐄂
Set 𐄂 𐄂 𐄂
Dictionary 𐄂
Thank You.