list tuple set dictionary in python

List Tuple Set Dictionary In Python

In this post we leant about.

  • what is list ,set ,tuple and dictnaroy.
  • What is the difference between of them.
  • How we denoted by list set tuple and dictnaroy.

List :

A collection of ordered data is called list and it is denoted by square brackets [].They allowed duplicate data. They are changeable.

Create list in Python:

list=["Apple","Bananas","Graphs","Oranges"]
print(list)

Note : list is a variable don't confused of them you write any variable on the place of list but list always denoted by Square brackets []. 

Set:

A collection of unordered data is called Set and it is denoted by curly brackets {}.They not allowed duplicate data.

Create Set in Python:

set={"Apple","Bananas","Graphs","Oranges"}
print(set)

Note : set is a variable don't confused of them you write any variable on the place of set but list always denoted by curly brackets {}.

Tuple:

 A collection of  ordered data is called tuple it is similar to list but they are allowed duplicate data, and they are denoted by round brackets (). They are unchangeable. 

Create tuple in Python:

tuple=("Apple","Bananas","Graphs","Oranges")
print(tuple)

Note : tuple is a variable don't confused of them you write any variable on the place of tuple but tuple always denoted by round brackets {}.

Dictnaroy:

A collection of unordered data that stores data key value pairs and they are denoted by curly brackets{}

Create dictnaroy in Python:

dict={
    1:"Apple",
    2:"Bananas",
    3:"Graphs",
    4:"Oranges"
}
print(dict)

Note : dict is a variable don't confused of them you write any variable on the place of dict but list always denoted by curly brackets {} and assign key value pairs .