Today, we will be looking at how we can work with Numbers(int, float, complex)
let's start with int
int data type refers to integers in mathematics
float data type refers to decimal point numbers
complex data type refers to numbers with real, imaginary part (generally used for scientific research purposes )
a = 22
b = 21
c = a + b
we can perform all the basic mathematic operations on integers like Addition
Subtraction
Multiplication
Division
Integer Division
Remainder
power
You might be wondering what's the difference between division and integer division
a = 5
b = 2
c = a/b
d = a//b
now, c holds a value of 2.5 , but d has a value of 2.
division(/) always returns a float ,whereas (//) always returns an int.
% - remainder of the division
** - power
x = 2
y = 7
z = y**x
q = y % x
z has a value of 7 raised to the power of 2 (49) , q has a value of remainder of 7/2 that is 1.
All these operations can be performed on Numbers(int, float, Complex)