Python Numbers
Numerical data types in Python are categorized into three types:
- int
- float
- complex
int
Integers are positive or negative whole numbers without decimal points.
Example:
x = 24
y =
100548
print(type(x))
print(type(y))
Output
<class 'int'>
<class 'int'>
Float
Floating-point numbers are real numbers containing a decimal point.
Example:
x = 2.34
y = 3.1
print(type(x))
print(type(y))
Output
<class 'float'>
<class 'float'>
complex
Complex numbers consist of real numbers and imaginary numbers.
Example:
x = 6j
y = -6j
print(type(x))
print(type(y))
Output
<class 'complex'>
<class 'complex'>