MediumPython Numerical Datatypes: int, float, complex | by Vedasaraswathit | Medium
Sitemap
Vedasaraswathit

Vedasaraswathit

Python Numerical Datatypes: int, float, complex

2 min readAug 17, 2026

--

In Python, numerical data types are a group of data types used to represent numerical values.

Python provides three main numerical data types:

  1. int
  2. float
  3. 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=10

Interning

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.

Press enter or click to view image in full size
Interning

2.float

It is a python numeric datatype by using which we can create any decimal values.

x=10.0
y=10.0

It can precise 16 decimal values 1.2345678901234567, float doesn’t support interning. It creates new new memory cells.

Press enter or click to view image in full size
float doesn’t support interning

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+0j

In 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 .

Press enter or click to view image in full size

--

--