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

  1. Numeric Types - int, float, complex
  2. Sequence Types - list, tuple, range
  3. Text Sequence Types - str
  4. Mapping Types - dict
  5. Set Types - set, frozenset
  6. Boolean Types bool
  7. None Types none
  8. 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: