Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis+ 1
What python use the BODMAS rule for calculation
4 Respostas
+ 1
yes
+ 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.
+ 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
0
Thanks