Numbers (int, float, complex)
In Python, numbers are one of the fundamental data types.
They are classified into three main types:
int – Integer Numbers
Represent whole numbers without a decimal part.
They can be positive, negative, or zero.
a = 10
b = -5
c = 0
float – Decimal Numbers
Represent real numbers with a decimal part. They can also be expressed in scientific notation.
pi = 3.1416
speed = 2.5e8 # 2.5 × 10^8
complex – Complex Numbers
Represent numbers with a real and an imaginary part, using j to denote the imaginary component.
z = 3 + 4j
You can perform operations between these types using standard arithmetic operators.