Primitive and non-primitive data structures in Python

in GitPlait4 years ago (edited)

Note : This tutorial only deals with the concept of data structure, I will discuss the next tutorial in detail.

code-1084923_1280.png

Source

Primitive data structures :

Primitive data structures are the basic ingredients in the Python programming language. These are predefined for storing data and the set of actions on these data structures are also predefined. It contains simple values of data.

Primitive data types in Python are as follows :

Strings :

Strings are words or letters. It means string represents a group of alphabetic words or character which are quoted by single or double quotations. For example - 'python', "python" etc.

Integers :

The integer represents numeric value without decimals. It is any whole number, positive or negative, like 10,21,-100.

Floats :

Float or floating-point number represents numeric values ending with a decimal point. Such as 1.29, or 0.123.

Boolean :

It represents only two values: True or False

data_types.jpg

Non-primitive data structure:

These data are sophisticated and derived from the primitive data structures. Used for grouping of homogeneous (same kind) or heterogeneous (a different kind) data items.

Python has generally some built-in Non-primitive data structures, which can be divided into the following categories :

1. Sequence Type: list, tuple, range
2. Set Types: set, frozenset
3. Mapping Type: dict

......................................................................................