There are three numeric types in Python :-
- int
- float
- complex
Int
Int, or integer, is a whole number, positive or negative, without decimals, of unlimited length.
Float
Float, or "floating point number" is a number, positive or negative, containing one or more decimals.
Complex
Complex numbers are written with a "j" as the imaginary part.
Example :-
x = 1
y = 1.0
z = -5j
print(type(x))
print(type(y))
print(type(z))
print(type(y))
print(type(z))
Comments
Post a Comment