Skip to Content
PythonPython Data TypesOverview

Python Data Types

Welcome to the wonderful world of Python data types! In the realm of computer programming, a data type is a category that tells the computer what kind of value a variable is holding.

Python comes pre-loaded with a variety of built-in data types. These act as the fundamental building blocks for holding, organizing, and manipulating data in your programs.

Understanding data types is incredibly important because it determines:

  • Which operations you can perform on your data (for example, you can multiply numbers, but you cannot multiply letters).
  • How the data is stored and handled inside your computer’s memory.
  • How you can structure your information to make your code clean, readable, and fast.

Let us explore the core categories of Python data types!

What are Data Types?

Get a friendly, foundational understanding of what data types are and why they are essential for any aspiring programmer.

Go to Introduction


Core Categories at a Glance

1. Numbers

  • int: Whole numbers of any size (for example: 42, -7).
  • float: Decimals and fractional numbers (for example: 3.14159, -0.001).
  • complex: Complex numbers with real and imaginary parts (for example: 3 + 5j).

2. Sequences

  • str: Text data, which is an immutable sequence of characters (for example: "Hello!").
  • list: An ordered collection of items that you can change at any time (for example: [1, 2, "apple"]).
  • tuple: An ordered collection of items that is locked and cannot be changed (for example: (10, 20)).

3. Key-Value Maps

  • dict: Key-value pairs for quick data association and fast lookup (for example: {"username": "cool_coder"}).

4. Unique Sets

  • set: An unordered group of unique elements (for example: {1, 2, 3}).
  • frozenset: An immutable, frozen version of a set.

5. Logic

  • bool: Logical values representing either True or False.

Getting Started

Let us begin with our Introduction to Data Types page to see these concepts in action and write your first type-checking code!

Last updated on