+ 1

What python use the BODMAS rule for calculation

16th Dec 2020, 5:40 PM
Frodo Baggins
Frodo Baggins - avatar
5 Réponses
+ 1
yes
16th Dec 2020, 5:53 PM
Jordan Kinney
Jordan Kinney - 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
Jordan Kinney
Jordan Kinney - 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
0
Python follows mathematical convention. The acronym PEMDAS i.e parenthesis exponent multiply divide addition subtraction
21st May 2024, 12:40 AM
Dhairya Singh Dhaila
Dhairya Singh Dhaila - avatar