6. AND - bool three - problem with operation order


#1

Hello,
I had a problem solving bool three during the AND exercise.

Set bool_three equal to the result of 19 % 4 != 300 / 10 / 10 and False

I have a question regarding the order of the operations. Which of the next two is correct and why?

a) 300 / 10 / 10 = 300 / (10 / 10) = 300
OR
b) 300 / 10 / 10 = (300 / 10) / 10 = 3

Thanks a lot for your help.


#2

For the sake of the lesson, neither is correct as it should be == as the comparator.

Mathematically, the second one would be correct as the left side will be executed left to right and the right side would be parenthesis first then left to right, which actually turns out to be the exact same math on either side.

The first one is incorrect as the would end up being 3 = 300. This would turn out to be false if you did:

300 / 10 / 10 == 300 / (10 / 10)

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.