Table of Contents
show
- Numeric data type represent the data which has numeric value
- Numerical Data type is immutable i.e. the value cannot be changed
- Numeric value can be Integer, floating number or even complex numbers
- These values are defined as int, float and complex class in python
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
Example
>>> x=1
>>> print(type(x))
<class 'int'>
Float
Example
>>> y=3.14
>>> print(type(y))
<class 'float'>
Complex
- Complex number is represented by complex class
- It is specified as a+j b
- Where a is real part and b is imaginary part
Example 4+2j
>>> z = 3+ 2j
>>> print(type(z))
<class 'complex'>
- type( ) function is used to determine the type of data type
Views: 14