When you start learning Python, one of the first things you'll encounter is the concept of data types.

Data types are fundamental because that tell a computer program what type of data is being handled.

What do I mean by data type?

Well, you might have the value 10 which is a numerical sort of data or the sentence "Hello World" which is textual.

Simply put, a data type is a categorization that tells the programming language what type of value a particular piece of data is.

Each data type in Python has its own unique properties and behaviors, in other words a set of rules for how you can manipulate and store them.

What Are the Simple Data Types in Python?

Here are some of the simplest types of data in Python, referred to as primitive data types.

Whole Numbers (Integers)

Just like the numbers you count with. Examples are 1, 2, 100. You use them anytime you count items that can’t be split, like people in a room.

Numbers with Decimals (Floats)

These are numbers that have parts smaller than a whole, like 1.5 or 2.75.

Yes or No (Booleans)

This type is super simple. It's just two options: True (yes) or False (no). You'll use these to make decisions in your code, like asking if something is correct or if a number is big enough.

Words and Sentences (Strings)

These are just text, like names, messages, or whole paragraphs. In Python, you put text in quotes like this: "hello" or "1234".

Nothing at All (NoneType)

Sometimes, you need to say there is nothing there, like an empty box or an unanswered question. In Python, you say None to mean nothing or no value.

Complex Data Types

When you need to organize or manage more data than just a few simple values, Python provides complex data types. These data types allow you to work with larger sets of information, organize it efficiently, and access it in useful ways.

Lists

A list in Python is a collection of items arranged in a specific order. For example, if you have a series of favorite books, you can store them in a list to keep track of their order. You can add, remove, or rearrange items in a list whenever you need to. Think of it like a row of containers where each container holds one item, and you can easily move them around.

Dictionaries

Dictionaries in Python help you store data as key-value pairs. For instance, if you want to keep track of your contacts and their phone numbers, a dictionary would allow you to store each person's name (the key) along with their phone number (the value). You can easily add new entries, update information, or remove entries as needed.

Classes

In Python, a class is a template for creating objects with specific properties and behaviors. For example, if you're building a game, a class can define the structure of a character, such as a wizard or a knight, outlining their abilities and traits. Once you've defined the class, you can create multiple characters

Why It Matters

These are the basic building blocks that form the foundation of more complex operations.

As you start your journey with Python, it's important to always be aware of the data type you are working with. Understanding these types of data helps you tell Python exactly what you want to do with your information.

We'll focus on the Simple Data Types...

For now, we will concentrate on learning the simple data types in Python, starting with Numbers..