In Python, numerical data types are used to store and perform operations with numbers. Python supports three main numerical types:
- Integer (
int
)
- Floating Point (
float
)
- Complex Numbers (
complex
)
1️⃣ Integer (int
)
- Represents whole numbers (positive, negative, or zero) without decimals.
- Commonly used for counting, indexing, looping, etc.
✅ Examples:
x = 5
age = -10
zero = 0
🔹 Properties:
- No decimal point
- Unlimited size (limited by memory)
2️⃣ Float (float
)
- Represents real numbers (numbers with decimal points).
- Used when precision is important — like currency, measurements, etc.
✅ Examples:
price = 19.99
height = -1.75
pi = 3.14159
🔹 Scientific Notation:
You can also write floats using exponential (scientific) notation:
value = 1.2e3 # = 1200.0