XuMuK XuMuK - 1 year ago 176
Python Question

Python mathematical operators sequence


And when we try to get result of this:

print str((23-11)/a*b)

We get the divide by zero error.

Traceback (most recent call last): File "", line 1, in

print str((23-11)/a*b) ZeroDivisionError: integer division or modulo by zero
But if we change positions:

print str((23-11)/b*a)

The result is zero:


Should we get always divide y zero error (because (b*a) is zero)?

Answer Source

((23-11)/a*b) becomes

enter image description here

((23-11)/b*a) becomes

enter image description here