Loading, please wait...

Python Numeric Data types

There are three numeric data types in Python given below:

  • int
  • float
  • complex

Int: Int, or integer is the whole number, positive or negative, without decimals, of unlimited length.

Example

Integers:

a = 2
b =
56222554887711
c = -
255544

print(type(a))
print(type(b))
print(type(c))

 

Float: Float, or "floating point number" is the number, positive or negative, containing one or more decimals.

Example

Float:

a = 2.20
b =
2.0
c = -
35.00

print(type(a))
print(type(b))
print(type(c))

 

Complex: Complex numbers always written with "j" as the imaginary part:

Example

Complex:

a = 3+5j
b = 5j
c = -5j

print(type(a))
print(type(b))
print(type(c))