Data Types In Python
Avinash Kumar
Posted on October 21, 2024
Let’s talk about data types in Python today!
But before we dive into Python’s specific data types, let’s first understand what data types actually mean.
If you break it down, the term "data types" can be understood as the type of data. For example, your name is a word, but your age is a number. These two things are different types of data. One is a string of characters (text), and the other is a numerical value.
In programming, data types help us define and categorize the kind of data we are dealing with, so the program knows how to handle it correctly.
For example: Your name is a word, but your age is a number.
Ok, so in Python, the following are the built-in data types:
int (Integer)
float (Floating point number)
str (String)
bool (Boolean)
Let’s talk about each of them:
int means integer. For example, a number without a decimal such as 3, 4, or 6.
float is also a number, but it has decimals. For example, 3.0 or 4.0.
str represents a sequence of characters, such as a word. For example, a name like "Avinash".
bool is either True or False. For example, "I am a genius 🤪🤪", which is True 🤪🤪.
Now, along with these, there are also some other data types in Python used to store multiple values:
list
set
dict
tuple
These are mainly used for storing more than one value at a time.
Posted on October 21, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.