Arithmetic Operators
1.Addition (x+y)
2.Subtraction (x-y)
3.Multiplication (x*y)
4.Division (x/y)
5.Modulus (x%y)
6.Exponentiation (x**y)
7.Floor Division (x//y)
Most of the students gets confused with Modulus,Exponentiation and Floor division so please keep it in mind:
1.Modulus return the remainder values.
2.Exponentiation return power value of x.
3.Floor Division return the values before the floating Point.
Hope you may all know the BODMAS Rule. Python follows BODMAS stands for Brackets(), Orders or Power, Division, Multiplication, Addition, Subtraction.
For example:
20-5*4+50/5 # BODMAS rule first calculates division and multiplication then after perform addition and subtraction.
=20-5*4+10
=20-20+10
=20+10-20
=30-20
=10
:-while performing Arithmetic operations Python used BODMAS rule.
Program using Arithmetic Operators.
Output
Comments
Post a Comment