Basic Data Types in Python | Python Web Development For Beginners
loader image
Python Web Development

Basic Data Types in Python

At the end of 2019, Python is one of the fastest-growing programming languages. More than 10% of developers have opted for Python development.

In the programming world, data types play an important role. Each variable is stored in different data types and responsible for various functions. Python had two different objects. They are mutable and immutable objects.

Mutable objects

The size and declared value and its sequence of the object can able to be modified called mutable objects. 

Mutable Data Types are list, dict, set, byte array

Immutable objects

The size and declared value and its sequence of the object can able to be modified.

Immutable data types are int, float, complex, String, tuples, bytes, and frozen sets.

id() and type() is used to know the Identity and data type of the object

Built-in data types in Python

Numbers (int,Float,Complex)

Numbers are stored in numeric types. When a number is assigned to a variable, Python creates number objects.

Python supports 3 types of numeric data.

int (signed integers like 20, 2, 225, etc.)
float (float is used to store floating-point numbers like 9.8, 3.1444, 89.52, etc.)
complex (complex numbers like 8.94j, 4.0 + 7.3j, etc.)
A complex number contains an ordered pair, i.e., a + ib where a and b denote the real and imaginary parts respectively).


The string can be represented as the sequence of characters in the quotation marks. In python, to define strings we can use single, double, or triple quotes.


In python, string handling is a straightforward task, and python provides various built-in functions and operators for representing strings.

The operator “+” is used to concatenate strings and “*” is used to repeat the string.


Tuple and Lists are nearly identical, Like lists, tuples can hold the collection of the different datatypes items. Items in the tuple are separated by commas (,) and should be enclosed within parentheses (). The only difference between the list and tuple are List are mutable but tuples are immutable. Tuples have read-only structure, So Size and Values in the items in the tuples are can’t be modified.“+” Operator is used to concatenate the Lists and “ * “ is used to repeat the lists.

Frozen sets

The frozen sets are similar to sets, the only difference is ‘set’ is mutable and ‘frozen set’ is immutable.assigned values and size of the frozen object can’t be changed.items in the frozenset are separated by comma(,) and declared as frozenset()


Lists in python are similar to arrays in C.the list can hold different types of data. In lists, items are stored in sequence with comma (,) Separator and should be enclosed within square brackets [].
“+” Operator is used to concatenate the Lists and “ * “ is used to repeat the lists


An ordered set of items with a key-value is called a dictionary. It is similar to an associative array,i.e) each value in the dictionary is stored in separate keys. Keys can contain any primitive data type. Items in the dictionary are separated by Comma(,) and enclosed within curly braces { } key id and Values are separated using “:”.Dictionary is a mutable data type, we can able to change the size and value of the dictionary.


In Python, There are two types of sets,1.sets and 2. Frozen sets. Set data type contains unordered items collection. The set is a mutable & iterated data type and it has no duplicate values. using set we can do some mathematical operations such as union, intersection, difference, and so on. The set is directly opposite to the list. Items in the sets are separated by Comma(,) and enclosed within curly braces { }.


The range function is used to generate a number sequence with a particular range and ability to perform an action for a specific number of is declared as a range().


The boolean data type has two constant objects true and false. It used to represent the declared values as true or false. If the condition satisfies the result will be True else False.boolean data type is declared as bool()


Bytes is an immutable sequence of integers in the range of 0 to 256, It prints the ASCII value of that integers. The immutable version of bytearray is bytes.the indexing and slicing behavior is the same in bytes and bytes is declared as bytes().

Byte Array

The mutable sequence of integers from 0 to 256. It is a usual method of mutable is declared as bytearray().

Memory View

The memory view of the given argument is returned by Memoryview function.A memory view is used to expose the buffer protocol in Safeway. A way to access the object’s internal data is called the buffer protocol. The internal data of an object is called a memory array or a buffer. It is declared as memoryview()

If you have a business idea in your mind or looking for a reliable web development company, you are in the right place. Hire the best Python developers in the industry from Agira technologies.

Turn your vision to magnificent reality With
Our Web and Mobile Solutions
The following two tabs change content below.
Vishnu Durga

Vishnu Durga

Vishnu Durga is a passionate GIS analyst at Agira Technologies. Enabling her strategic insights in GIS, and data intelligence she has assisted numerous businesses in planning and to make informed business decisions. Apart from data collection and management, she loves to do some art in her leisure moments.
Vishnu Durga

Latest posts by Vishnu Durga (see all)

Leave a Reply

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

Join our 30,000+ subscribers, never miss out anything on our latest blogs, tips, tutorials, updates & more.