In programming, we work with data. When we write programs, we need an efficient way to store and manage this data — that's where variables come in. Variables are like labeled containers that hold different types of data depending on what we need to do.
There are various types of data such as:
10
, 5
)3.14
, 99.99
)"Hello World"
)True
, False
)[1, 2, 3]
)Each type of data is used differently and has its own special behaviors. Here's what some of them can do:
+
), subtraction (-
), multiplication (*
), and division (/
).+
operator.True
or False
and are often used in conditions or comparisons.<aside> 🤔
You can get the data type of any object by using the type()
function:
x = 5
print(type(x)) # outputs <class 'int'>
</aside>
👉 Here is a summary of categorized Python built-in data types.
Category | Data Type |
---|---|
Textual | str |
Numerical | int ,float , complex |
Sequential | list , tuple , range |
Mappable | dict |
Set Types | set |
Boolean | bool |