Numbers in Python

In Python, numbers can be represented in many ways and Python provides different types for working with these numbers. The primary numeric types in Python include:

  • int
  • float
  • complex

int

The int data type is a numeric type without fractional point.

Example:

x = 100
print(x)

Output:

100

float

The float data type is a numeric type with fraction point.

Example:

x = 100.70
y = 53e43
print(x)
print(y)

Output:

100.70
5.3e+44

complex

The complex data type is a numeric type with real and imaginary components denoted by j character.

Example:

z = 7j
print(z)

Output:

7j