Data type is an important concept in programming. Variables can store data of different types, and different types have different purpose. Here we will discuss about Python Data Types.

Python Data Types

In Python, data type is set when you assign a value to a variable.

Python has the following data types –

ExampleData Type
x = 10int
x = “Hello Python”str
x = 10.5float
x = 10jcomplex
x = [“Python” , “JavaScript” , “ReactJs”]list
x = (“Python” , “JavaScript” , “ReactJs”)tuple
x = {“Python” , “JavaScript” , “ReactJs”}set
x = {“name” : “Max” , “age” : “20”}dict
x = frozenset({“Python” , “JavaScript” , “ReactJs”})frozenset
x = range(5)range
x = Truebool
x = b”Hello Python”bytes
x = bytearray(5)bytearray
x = memoryview(bytes(5))memoryview
x = NoneNoneType

We can check data type of any value –

x = 10
print(type(x))

Result -
<class 'int'>

Leave a Reply

Your email address will not be published. Required fields are marked *