Let's learn Datatypes in Python

kanak Gupta Mar 25 2021 · 1 min read
Share this

Why do we need to know Datatypes in Python?

The 3 most important things are always keeping in mind using python First, it is Case sensitive, second, is indentation problem, and third is data types We can perform operations only on the same data type variables if they are not the same types then we use type-casting and make them into similar data types.

Let's dive into the concepts of data types.

Datatypes

We can understand data types are the classification or categorization of data items. Since everything is an object in Python programming, data types are actually classes and variables are objects of these classes and we can determine data items by using the type() function.

Types of Data types

There are 2 types :

1. Primitive Datatypes(Immutable): These are the building blocks of data manipulation and have the property of immutable, which means the original value of items doesn't change.

a) Numeric - Integer, Float, Complex b) Text - Strings c) Boolean - True, False

2. Non-Primitive Data types(Mutable) - They are acted as a container when we want to store large numbers of heterogeneous or homogenous primitive datatype values then we use the following classes as given below.

i) List [], ii) Tuple (), iii) Set {}, iv) Dictionary {Key:Value}

These classes possess the mutable quality except tuples, which means the original data can be changed by using index numbers.

Thanks for reading,

The implementation of Primitive datatypes in Python with code will be uploaded soon.

Comments
Read next