Data Types in Python

Share Your Love

In this post here discussing about data types in python. How, it helps python to take decision on what type of data the variable can access.

variable is a name of a location in a memory where values are stored. Each variable should be initialised or defined with a data storage format to continue with the operations in the program. These data storage formats are known as data types.

Python has the following data types built-in by default, in these categories:

for text type:str(string)
for numeric type:int(integer)floatcomplex
for sequence type:listtuplerange
for mapping type:dict(dictionary)
for set type:setfrozenset
for boolean type:bool
for binary type:bytesbytearraymemoryview
Data Types In Python

Let us see how to initialize data type in python:

Python allows auto-assignment to variables when data is assigned to the variable.

Note: when a variable is initialized with an integer variable, it is by default assigned as str or string. So, for integer variables we need to assign them as integers.

For example:

(str) type a ="lingarajtechhub"
(complex) type a=2a
(list) type a= [20, 10, 5]
(tuple) type a= (20, 10, 5)
(dictionary) type a= {"value":20, 
(boolean) type a= true

We can also assign specific data type in python, for example:

a= str("lingarajtechhub")
a=list((20, 10, 5))
a=tuple((20, 10, 5))
a=frozenset(("Bhubaneswar", "Kolkata", "Delhi")

We can also check the data type of any variable using the type function, which returns us the type of the variable initialized.

Let us see some examples:




dzkeRKn uYGA gxl68hrgCSC RoGDZFgOB5whd Q9hFj8rTO4GrJ9d7UBLNTaT2eYMvqrQoRgczO Gl0Ik8bTCKZgkZLXiOIi6BkPlZztuf8




mN12Pqp 4VwmLswCkTZvRq1NsCb9nE6S60GcGtyqb Q p8vnJFtRtBRg0D6Iol5Vb4Yq aE7HkKcmqgma1HPazT 5baqjAN9RjkqYI5tLtICi3DX466R1DXNNYpDtIwNXneBLA

Here we come to the end of the topic on data types in python. Hope we were able to clear all your doubts.

Please comment and share this article if you find helpful and wants to improve WhatsApp us.

Share Your Love
Avatar photo
Soham Malakar

Hello my name is Soham Malakar am currently pursuing BCA

Coding is one of my favorite hobbies.
I love to code and an enthusiast to learn different types of programming languages.
I love to get intoxicated in the world of technology and video games.
A quick learner possessing better results.

Articles: 40

Newsletter Updates

Enter your email address below to subscribe to our newsletter