Python Numerical Datatypes: int, float, complex
In Python, numerical data types are a group of data types used to represent numerical values.
Python provides three main numerical data types:
- int
- float
- complex
1. int
int refers integer, integer is a python datatype by using we can create any real numbers. Integer is represented by int. It can store numerical values.
for eg :
x=10
y=10Interning
It is a simple technique by using which python engine allocates a small space/memory(cache: store a range of values).
Get Vedasaraswathit’s stories in your inbox
Join Medium for free to get updates from this writer.
Integer supports interning, it saves the memory don’t waste memory for duplicate values.
2.float
It is a python numeric datatype by using which we can create any decimal values.
x=10.0
y=10.0It can precise 16 decimal values 1.2345678901234567, float doesn’t support interning. It creates new new memory cells.
3. Complex
It is a python datatype by using which we can create a complex data. Complex datatype having two parts one is real part and another is imaginary part.
x=1+0j
y=1+0jIn real data is having both int & float values, it supports both. But in imaginary part nobody no exact value in it, that’s why it becomes more complex. Python allows j & J only as a imaginary Part with real value. It doesn’t support interning .






