In programming, data type is an important concept. In this article, I am going to discuss Data Types in Python with Examples.  The data can be categorized into different types like integers, float numbers, boolean, string, etc. Categorizing the data is important in order to perform the operations on it. Python variables can store data of different types, and different types can do different things.

Python Built-in Data Types:

Python has the following built-in data types

Text Type:str
Numeric Types:intfloatcomplex
Sequence Types:listtuplerange
Mapping Type:dict
Set Types:setfrozenset
Boolean Type:bool
Binary Types:bytesbytearraymemoryview
None TypeNoneType

Example of data type:

x = 20                              # int
x = 20.5                            # float
x = 1j                              # Complex
x = ["one", "two", "three"]	        #list
x = range(6)	                    #range
x = ("one", "two", "three")         #tuple
x = {"name" : "John", "age" : 36}   #dict
x = True                            #bool
x = b"Hello"                        #bytes
x = bytearray(5)	                #bytearray 
x = None	                        #NoneType

Comments are closed.

Explore More

Create new Python Virtual environment

Create a new virtual environment  Python 3 allows you to manage separate package installations for different projects. It creates a “virtual” isolated Python installation. When you switch projects, you can

What are Large Language Models

LLM stands for Large Language Model in the context of artificial intelligence. It refers to a type of AI model designed to understand, generate, and manipulate human language on a

Python 10 Programs for Beginners

Program 1:Write a program to create a 2D array using NumPy. Output: Program 2: Write a program to convert a python list to a NumPy array. Output: Program 3: Write a program to create matrix of 3×3 from 11 to 30. Output: Program 4: Write a program to create a data frame to store data of candidates who appeared in