>> Arithmetic operators
+ (Addition)
- (Subtraction)
* (Multiplication)
/ (Division)
// (Floor Division)
% (Modulus)
** (Exponent).
>> Other operators are Comparison, Assignment and Logical which are most widely used.
1) Adding two variables:
a = 12
b = 231
add = a + b
print('The addition is:', add)
#Output: The addition is: 243
2) Subtracting two variables:
a = 12
b = 231
subtract = b - a
print('The subtraction is:', subtract)
#Output: The subtraction is: 219
3) Multipling two variables:
a = 12
b = 231
multiplication = a * b
print('The multiplication is:', multiplication)
#Output: The multiplication is: 2772
4) Dividing two variables:
a = 12
b = 231
division = b/a
print('The division is:', division)
#Output: The division is: 19.25
5) Floor division:
a = 12
b = 231
floor_division = b//a
print('The floor division is:', floor_division)
#Output: The floor division is: 19
6) Modulus:
a = 12
b = 231
modulus = b % a
print('The modulus is:', modulus)
#Output: The modulus is: 3
>>Modulus is the remainder when we divide Dividend by a Divisor.
7) Exponent:
a = 12
b = 231
exponent = b ** a
print('The exponent is:', exponent)
#Output: The exponent is: 23085737796000848857434784161
Comments
Post a Comment