Arithmetic Operations
Arithmetic Operations
Arithematic Operators are either symbols or elements to represent a specific mathematical function that is to be performed on values on variables in a python code.
Example:
In [1]:
#Addition
a = 345
b = 987
print(a+b)
1332
Example:
In [2]:
#Substraction
a = 500
b = 250
c = a - b
print(c)
250
Example:
In [4]:
#Division
a = 81
b = 3
print(a/b)
27.0
Example:
In [5]:
#Multiplacation
a = 3.2
b = 4.3
c = 9.4
print(a*b*c)
129.344
Exponentation
Double Asteriks:Returns exponent of the base, like, 2 raised to 4 is 222*2=16.
Example:
In [6]:
a = 5
b = 3
print(a**b)
125
Modulus
Remainder of the divsion;Symbol: %.
In [7]:
a = 4
b = 21
print(b%a)
Example:
In [9]:
a = 253
b = 5
print(a//b)
50
In [ ]: