Float Methods
float.is_integer()
Check whether a float is finite and has no fractional part in its stored value. Both positive and negative zero qualify; NaN and infinities do not. This does not mean that the object has int type, or that the original decimal input had no fraction before rounding.
Formal Syntax & Structure
python syntaxpython
value.is_integer()Return Value
bool
True for finite integral-valued floats.
Working Example
Example Snippetpython
for value in (4.0, -2.5, -0.0, float("inf")): print(value.is_integer())