🔍 Understanding Python Data Types
lilo-creator

lilo-creator @lilocreator

Joined:
Jun 24, 2025

🔍 Understanding Python Data Types

Publish Date: Jun 27
1 0

Python is a popular programming language known for its simplicity and readability. But before you dive deep into coding, one of the most important concepts to grasp is data types.
Think of data types like different kinds of boxes you can use to store information. Each box (data type) holds a specific kind of value — like numbers, words, lists of things, etc.
Below are some of the data types that are common;

**

1️⃣ Numbers

**
These are used to store numeric values.
Integers (int): Whole numbers — e.g., 3, 0, -5
Floats (float): Decimal numbers — e.g., 3.14, -0.5
Complex (complex): Numbers with real and imaginary parts — e.g., 2 + 3j

age = 21        # int
height = 5.6    # float
z = 2 + 3j      # complex
Enter fullscreen mode Exit fullscreen mode

2️⃣ Strings (str)

A string is a sequence of characters — usually used to represent text.

name = "Lilian"
greeting = 'Hello, world!'
Enter fullscreen mode Exit fullscreen mode

**

3️⃣ Booleans (bool)

**
Booleans represent True or False values — great for decisions and logic.

is_logged_in = True
has_passed = False
Enter fullscreen mode Exit fullscreen mode

**

4️⃣ Lists (list)

**
Lists are ordered collections of items — like a shopping list 🛒.

fruits = ["apple", "banana", "mango"]
numbers = [1, 2, 3, 4]
Enter fullscreen mode Exit fullscreen mode

**

5️⃣ Tuples (tuple)

**
A tuple is just like a list — but it cannot be changed after creation.

It's immutable.
coordinates = (10, 20)
Enter fullscreen mode Exit fullscreen mode

**

6️⃣ Dictionaries (dict)

**
Dictionaries store key-value pairs — like an ID and its name.

user = {
    "name": "Lilian",
    "age": 22,
    "is_active": True
}
Enter fullscreen mode Exit fullscreen mode

**

7️⃣ Sets (set)

**
A set is a collection of unique items, no duplicates allowed.

colors = {"red", "blue", "green", "red"}
print(colors)  # {'red', 'blue', 'green'}


Enter fullscreen mode Exit fullscreen mode

Comments 0 total

    Add comment