Python tutorial

Python data types

You can check what type of object is assigned to a variable using Python's built-in type() function. Common data types include:

Text Type: str
Numeric Types: intfloatcomplex
Sequence Types: listtuplerange
Mapping Type: dict
Set Types: setfrozenset
Boolean Type: bool
Binary Types: bytesbytearraymemoryview

Getting the Data Type

You can get the data type of any object by using the type() function:

lets create a new file and name it as demo_type.py and write this below code

x = 5

Execute the code in following below manner.

C:\Users\My Name>python demo_type.py
<class 'int'>