Datatypes in Python.

Author: neptune | 22nd-May-2022 | Views: 408

Different types of Datatypes in Python

  • Numbers 

  • Strings

  • Lists 

  • Tuples

  • Dictionary

  • Set

  • Frozenset 

1. Numbers 

Python supports integers, floating-point numbers, and complex numbers. In Python, these numbers are defined as int, float, and complex classes in Python.

When we put a decimal in an Integer then it converts into a Floating-point number. 

Example: 5 is an integer while 5.0 is a floating-point number.

Points to remember :

1. Integer length is not defined it can be of any length.

2. Floating-point is valid till 15th place 16th place is invalid.

Numbers we use daily are of type decimal (Base 10) number system. But other number systems are also present like Binary (Base 2), Hexadecimal (Base 16), and Octal (Base 8).

It's simple to represent these numbers in Python.

Number System



‘0b’ or  ‘0B’


‘0o’ or ‘0O’


‘0x’ or ‘0X’

Example :

Complex numbers are represented in form of (x+yj)  where x is a real part while y is an imaginary part.

That’s all you need to know about numbers in Python.

2. Strings

String is a sequence of Unicode characters.

Points to remember:
1. String can be represented using single quotes ‘Neptune’ or double quotes “Neptune”.

2. Multiline Strings can be represented using tripe quotes.


3. Strings are immutable in Python.

3. Lists

List is an ordered sequence of items. It is a widely used datatype in Python.

Points to remember:

1. We can declare a list using [ ] or list class.

2. List index starts from Zero. 

Example :

3. Lists are mutable datatype means we can change the values in the existing list.


4. List is a heterogeneous datatype which means we can store different types of data in a single list.

Examples :

5. List can also be sliced using [ start index: end index - 1 ].


4. Tuples

Tuple is the same as a list it is an ordered sequence of items. But tuple is an immutable data type which means it can’t be modified once created.

1. We can create a tuple using ( ) or tuple class.

2.Tuple is immutable in nature.

3. Tuple values can be accessed using [ ] just like a list.

5. Dictionary

Dictionary is an unordered collection of key-value pairs. It can be defined within braces { key: value } where key and value can be of any data type.


1. Using the key we can fetch value in constant time O(1).


2. Different types of keys.


6. Set

Set is an unordered collection of Unique items. It is defined using { } values separated by comma.


1. Set is an unordered datatype so there is no index.



FrozenSet is a modified version of Set. FrozenSet values can’t be changed after creation while we can add or remove values from Set.


1. We can’t add or remove value from frozenSet.

These all are the data types in python. Hope you got something from this article.

Thanks for Reading !!!

anonymous | May 22, 2022, 10:25 a.m.

Very well explained

Related Blogs
How to extract Speech from Video using Python?
Author: neptune | 01st-Dec-2022 | Views: 3403
Simple and easy way to convert video into audio then text using Google Speech Recognition API...

How to download video from youtube using python module ?
Author: neptune | 22nd-May-2022 | Views: 2061
We will let you know how you can easily download the Youtube high quality videos along with subtitle, thumbnail, description using python package..

Mostly asked Python Interview Questions - 2022.
Author: neptune | 25th-May-2022 | Views: 1161
#Python #Interview
Python interview questions for freshers. These questions asked in 2022 Python interviews...

How to reverse string in Python ?
Author: neptune | 16th-May-2022 | Views: 1037
We are going to explore different ways to reverse string in Python...

Python Built-in functions lambda, map, filter, reduce.
Author: neptune | 22nd-May-2022 | Views: 951
We are going to explore in deep some important Python build-in functions lambda, map, filter and reduce with examples...

Best Python package manager and package for virtual environment ?
Author: neptune | 15th-Apr-2022 | Views: 897
#Python #Anaconda #Virtualenv #Pip
Which is the best package manager for python and Virtual environment management using Virtualenv and Anaconda...

Deploy Django project on AWS with Apache2 and mod_wsgi module.
Author: neptune | 22nd-May-2022 | Views: 872
#Python #Django
In this blog I use the AWS Ubuntu 18.22 instance as Hosting platform and used Apache2 server with mod_wsgi for configurations. We create a django sample project then configure server...

Will, AI kills Developer's jobs?
Author: neptune | 22nd-May-2022 | Views: 691
#Python #Machine learning #AI
GPT-3’s performance has convinced that Artificial intelligence is closer or at least AI-generated code is closer than we think. It generates imaginative, insightful, deep, and even excellent content...

Core Python Syllabus for Interviews
Author: neptune | 11th-Jun-2022 | Views: 680
#Python #Interview
STRING MANIPULATION : Introduction to Python String, Accessing Individual Elements, String Operators, String Slices, String Functions and Methods...

Do you know Jupyter is now full-fledged IDE?
Author: neptune | 15th-Apr-2022 | Views: 638
#Python #Jupyter
Jupyter is a widely used tool by Data scientists. So developers from institutions like Two Sigma, Bloomberg and convert it into IDE lets see..

View More