Python Question


#1

Can anyone explain to me this part of the python conditionals lesson?

Set bool_two equal to the result of
-(-(-(-2))) == -2 and 4 >= 16 ** 0.5


#2
-(-(-(-2))) == -2   and   4 >= 16 ** 0.5

Work through the brackets from the inside out…

-( -( -1 * -2 ) )

-( -1 * 2 )

-1 * -2

2

We can stop right there since 2 is not identical to -2. The rest of the expression will be ignored due to short-circuiting (False in an AND).


#3

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