Python Collections — List, Tuple, Dictionaries & Sets

Hritika Agarwal
2 min readMay 27, 2020

--

Collections in python can be referred as a container which is used to store collection of data. There are some built-in collections such as list, tuple, set and dictionary.

LIST

Lists are a used for preserving a sequence of data and then need not to be homogenous all the time, and are ordered and mutable i.e it can be changed after being created.

Functions for List-

TUPLE

Tuples are the collections in python which are immutable i.e. cannot be changed and are ordered.

Functions for Tuple -

To change value in tuple, first converted into list and then again in tuple

x =(“a”, “b”, “c”)

y = list(x)

y [2] = “h”

x = tuple (y)

DICTIONARIES

Dictionaries are python collections which is not only unordered but also allows no duplicate members.

Functions for Dictionary-

SETS

Sets are collections which are neither ordered nor allows duplicate members .They are non-changeble, but new data can be added in them.

Functions for Set-

--

--

No responses yet