Python – Numbers:
In Python, Numbers can be defined in three ways.
Let us understand how to work with Integer numbers
>>>x = 10 # assigning the integer value to variable x >>>x 10
we can identify which type of value the variable x is holding
>>>x=10 >>>type(x) <class 'int'>
Let us understand how to work with Float numbers
>>>y=10.1 # assigning the float value to variable y >>>y 10.1
Let us identify the type of value the variable y is holding
>>>y=10.1 >>>type(y) <class 'float'>
Let us understand how to work with complex type
>>>x=4+2y # 4 is the real part and 2y is the imaginary part
We can perform the various calculations with these numbers.
Let us see few examples below.
>>>5+5 10 >>>5*5 25 >>>5-4 1