Python Data Types
Last updated Aug 08, 2021Python 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: | int , float , complex |
Sequence Types: | list , tuple , range |
Mapping Type: | dict |
Set Types: | set , frozenset |
Boolean Type: | bool |
Binary Types: | bytes , bytearray , memoryview |
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 :
|
|
|
|
143 Views |