BASIC MATH CALCULATION with PYTHON. ( BASIC PYTHON OPERATORS)
The best way to start the python is by learning basic functionality. Here we are going to discuss the basic mathematical functions usage.
Symbol Operation
+ Addition
- Subtraction
* Multiplication
/ Division
Example :
>>> 4 + 2
6
>>> 14 - 9
5
>>> 6 * 15
90
>>> 90 / 12
7.5
>>>
ORDER OF Operations:
As is mathematics the order of operation in Python also the same.
Multiplication - Division - Addition - Subtraction
Example :
>>> 3 * 10 + 2 / 2 - 1
30.0
>>> 40 / 10 * 4 + 5 - 3
18.0
Another factor is the use of parentheses. which is used to nest the mathematical operations.
Example :
>>> 40 / 10 * 4 + 5 - 3
18.0
>>> 40 / 10 * (4 + 5) - 3
33.0
>>> 3 * 10 + 2 / 2 - 1
30.0
>>> 3 * (10 + 2) / (2 - 1)
36.0
No comments:
Post a Comment