id( ) function returns different value when using same float number

39 Views Asked by At

When declared an integer to a variable, both the integer and variable returns the same id value. But, in case of float, it returns a different id value. What is the reason behind it?

As below,

a=10
>>> id(a)
48068132
>>> id(10)
48068132
>>> b=10.1
>>> id(b)
50912320
>>> id(10.1)
50912336
0

There are 0 best solutions below