integers python
May 22, 2021
Python supports integers, floating-point numbers and complex numbers. They are defined as int
, float
, and complex
classes in Python.
Integers and floating points are separated by the presence or absence of a decimal point. For instance, 5 is an integer whereas 5.0 is a floating-point number.
Complex numbers are written in the form, x + yj
, where x is the real part and y is the imaginary part.
We can use the type()
function to know which class a variable or a value belongs to and isinstance()
function to check if it belongs to a particular class.