Numeric data types provide the foundation for mathematical operations in Python. There are three main numeric data types in Python: integer, float, and complex.


Integers (int) are whole numbers without a fractional component. They can be positive or negative (e.g., -5, 0, 10). Integers have unlimited precision, meaning they can represent arbitrarily large or small numbers.

# Integer
num1 = 10
num2 = 1001
num3 = 2516801185


Floating-point (float) numbers represent real numbers with a fractional component. They are specified using decimal notation, with an optional exponent, such as 3.14, -0.5, 1e-3.

# Floating-Point
num3 = 3.14
num4 = 123.4


Complex numbers are used to represent numbers with both a real and imaginary part. They are specified using the j or J suffix to denote the imaginary unit, such as 2 + 3j, -1j.

# Complex
num3 = 3 + 5j