Numeric Data
In Python, numeric information is represented by the following three data types:
int- the data typeintis for integers or the numbers that don't have the decimal point.float- the data typefloatis for numbers with decimal points.complex- the data typecomplexis for the numbers that contain an imaginary value. Let's implement one of each:
PYTHON
1intVariable = 5
2floatVariable = 4.5
3complexVariable = complex(4, 3)Now, if we want to check the types using the type() function:
PYTHON
1print(type(intVariable))
2print(type(floatVariable))
3print(type(complexVariable))The output will be:
PYTHON
1<class 'int'>
2<class 'float'>
3<class 'complex'>xxxxxxxxxximport cmath intVariable = 5floatVariable = 4.5complexVariable = complex(4, 3)print(type(intVariable))print(type(floatVariable))print(type(complexVariable))OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment


