10 % 10 <= 20 - 10 * 2

Acc to BODMAS rule 20 - 10*2 should be=0 so the argument should be false.

But here I could only proceed after giving True!

What is going wrong in my case?

Help will be highly appreciated!

`Replace this line with your code.`

10 % 10 <= 20 - 10 * 2

Acc to BODMAS rule 20 - 10*2 should be=0 so the argument should be false.

But here I could only proceed after giving True!

What is going wrong in my case?

Help will be highly appreciated!

`Replace this line with your code.`

The condition that you have provided returns true because 20 - 10 * 2 = 0 and 10 % 10 = 0. I am not sure exactly where the confusion is. If this still doesn't make sense please let me know.

@shibaprasad Let's take this step by step.

The % function in Python checks the remainder, so since 10 is divisible by 10, the remainder should be 0 (otherwise known as no remainder). Therefore, this side of the function is 0.

The other side says:

By order of operations in math, first we multiply 10 and 2 which equals to 20, then we subtract 20 from 20 which gives us zero. Now since the sign indicates less than or equal to, this statement should be true, as 0 = 0.

I hope you understand now.

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