Difference between List, Tuple, Dictionary, and Set in Python

This article is created to differentiate the four built-in data types of Python, that are used to store collection of data. The four built-in data types, that are differentiated here, are:

  1. list
  2. tuple
  3. dictionary
  4. set

The table given below, differentiates among above four data types of Python, in brief.

List Tuple Dictionary Set
ordered ordered ordered unordered
changeable (mutable) unchangeable (immutable) changeable mutable if created with set
immutable if created with frozenset
allows duplicates allows duplicates does not allows duplicates does not allows duplicates
List items enclosed within [ ] Tuple items enclosed within ( ) Dictionary items enclosed within { } Set items enclosed within { }
List can be created using list() Tuple can be created using tuple() Dictionary can be created using dict() Set can be created using set()

Python Online Test

« Previous Tutorial Next Tutorial »

Follow/Like Us on Facebook

Subscribe Us on YouTube