Numeric Data Type
Numeric data types represent the data with numeric values. Numeric values can be integer, floating or even complex numbers.
Integers
This value is represented by int class. It contains positive or negative whole numbers (without fraction or decimal). In Python there is no limit to how long an integer value can be.
Float
This value is represented by the float class. It is a real number with floating point representation. It is specified by a decimal point. Optionally, the character e or E followed by a positive or negative integer may be appended to specify scientific notation.
Complex Numbers
Complex numbers are represented by complex class. It is specified as (real part) + (imaginary part)j. For example 2+3j. The type() function is used to determine the type of data type.
Example:
# Demonstrate numeric value
a = 5
print("Type of a: ", type(a))
b = 5.0
print("\n Type of b: ", type(b))
c = 2 + 3j
print("\n Type of c: ", type(c))
Output:
Type of a: <class 'int'>
Type of b: <class 'float'>
Type of c: <class 'complex'>