Numbers In Python 3-Int-Floating Point-Complex Numbers

Numbers In Python 3

In python there are three types of numbers one is an integer and the second one is float point and the third one is complex.

Integers in python:

Integer is nothing but whole numbers or positive or negative numbers without decimals.

Ex: 0,1,2,3 , -1, -2

Floating point in python:

Floating point nothing but decimal values.

Ex 10.5,2.5, -1.1, -2.8

Complex Numbers In Python:

We know that complex numbers are a combination of real number and imaginary number

We generally represent complex numbers in the a+jb form

Ex 2+j5, 5+9j………….

In python also complex numbers are defined as normal mathematical complex numbers.

type() function:

To find which type of numbers we use type() function in python

>>> print(type(0))
<class 'int'>
>>> print(type(-5))
<class 'int'>
>>> print(type(66))
<class 'int'>
>>> print(type(-8))
<class 'int'>
>>> print(type(-8.6))
<class 'float'>
>>> print(type(10.3))
<class 'float'>
>>> print(type(2+3j))
<class 'complex'>
>>> print(type(3j))
<class 'complex'>

 

Leave a Reply

Your email address will not be published. Required fields are marked *