What python use the BODMAS rule for calculation | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What python use the BODMAS rule for calculation

16th Dec 2020, 5:40 PM
Frodo Baggins
Frodo Baggins - avatar
4 Answers
+ 1
yes
16th Dec 2020, 5:53 PM
xJAYOx
xJAYOx - avatar
+ 2
Python follows the traditional mathematical rules of precedence, which state that multiplication and division are done before addition and subtraction. (You may remember BODMAS.) This means in our example above, 2 and 4 are multiplied first, and then the result is subtracted from 10.
16th Dec 2020, 5:41 PM
xJAYOx
xJAYOx - avatar
+ 2
That means yes python use BODMAS print (1+7-3*5/8)//so in this case according to BODMAS Operations are follows Operation 1:Divide Operation 2: multiplication Operation 3: Addition Operation 4: Substraction
16th Dec 2020, 5:52 PM
Frodo Baggins
Frodo Baggins - avatar
0
Thanks
18th Dec 2020, 4:38 PM
Frodo Baggins
Frodo Baggins - avatar