Data Types - Introduction
Data type or simply a type is the classification of a data item. In Python evrything can be classified to types. The type tells the interpreter how the programmer intends to use the data. Python has several data types that provide a convenient way to make use of numbers, text and much more. The next pages in the tutorial deep dives into different data types.
Built-in Data Types in Python
- Numeric Types - int, float, complex
- Sequence Types - list, tuple, range
- Text Sequence Types - str
- Mapping Types - dict
- Set Types - set, frozenset
- Boolean Types bool
- None Types none
- Binary Sequence Types - bytes, bytearray, memoryview
Python Type Function
The type() function returns the data type of a variable. It is very common for a programmer to ask "how to find the type of a specific object". The type() function is the way to do it:
x = 5
y = 'Hello, World!'
print(type(x))
print(type(y))
Data Types Index: