Tutorial
Basic Data Types in Python
In Python, variables can store different types of data. Each type has its own characteristics. Let's look at the most common basic data types.
Python is a dynamically typed language. You don't need to declare variable types — the interpreter infers them from the values you assign.
1. Integer (int)
Whole numbers without decimals are called integers.
2. Float (float)
Numbers with decimals are called floats.
3. String (str)
Text is called a string. Always use quotes around text: single (') or double (").
4. Boolean (bool)
Boolean values represent True or False.
Check the Data Type
You can use type() to see what type a variable is:
Quick Recap
- int: Whole numbers (e.g., 10, 2025)
- float: Numbers with decimals (e.g., 5.9, 9.99)
- str: Text surrounded by quotes (e.g., "Alice")
- bool: True or False values
These are the basic data types you will use most often in Python. Next, you'll learn how to work with them in operations and expressions.