Built-in Data Types

Here is a list of Python’s built-in data types:

🔢 Numeric Types

Python Numeric data types represent values that are numbers. The main types are int (integers), float (decimal numbers), and complex (complex numbers with real and imaginary parts).

  1. int – Integer numbers (e.g., 10, -5)
  2. float – Floating-point numbers (e.g., 3.14, -0.001)
  3. complex – Complex numbers (e.g., 2 + 3j)

Do it


🔤 Text Type

  1. str – String (e.g., "Hello", 'Python')

Do it


📦 Sequence Types

Sequence data types in Python are ordered collections used to store multiple items in a single variable. Examples include list, tuple, range, and str, where elements can be accessed using indexing.

  1. list – Ordered, mutable collection (e.g., [1, 2, 3])
  2. tuple – Ordered, immutable collection (e.g., (1, 2, 3))
  3. range – Immutable sequence of numbers (e.g., range(5))

Do it


🔑 Mapping Type

Python mapping data type stores key-value pairs, where each key maps to a specific value. The primary mapping type in Python is the dict (dictionary).

  1. dict – Key-value pairs (e.g., {"name": "Alice", "age": 30})

Do it


🔘 Set Types

The set data type in Python is an unordered collection of unique elements. It is used to perform operations like union, intersection, and difference.

  1. set – Unordered, mutable set of unique items (e.g., {1, 2, 3})
  2. frozenset – Immutable set of unique items

Do it


Boolean Type

Boolean type data in Python represents one of two values: True or False.
It is commonly used in conditions, comparisons, and control flow statements.

  1. bool – Boolean values (True or False)

Do it


Binary Types

Binary type data in Python is used to handle binary data such as images, files, or byte streams. It includes types like bytes, bytearray, and memoryview.

  1. bytes – Immutable sequence of bytes (e.g., b"hello")
  2. bytearray – Mutable sequence of bytes
  3. memoryview – Memory view object of another binary object

Do it