Python Data Types

Last updated Aug 08, 2021

Python Data Types

Variables can store data of different types, and different types can do different things and these are known as Data Types. Data types are the classification or categorization of data items. Data Types are very important because the specific Data Type will determine what values are needed to be assigned to it and what operations one can perform for that operation.

There are several Data Types in Python. The default ones are listed below:-

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

 

Let's take few examples for these default and basic datatypes:-

x = 20

 

20

x = ["apple", "banana", "cherry"]
 ['apple', 'banana', 'cherry'

x = range(6)

 

range(0, 6)

 

Article Contributed By :
https://www.rrtutors.com/site_assets/profile/assets/img/avataaars.svg

143 Views