print(not 42 == "any_string")
not 42
evaluates to False and "any_string" would evaluate to a boolean True.
So, not 42 == "Answer"
should evaluate to False but it evaluates to True. How is this possible?
CodePudding user response:
it's order of preference
first this condition will be executed 42 == "any string"
and the output of this is False
then comes not
so not False
is True
this is why the output is True
CodePudding user response:
The true order is:
First: 42 == "any_string"
--> false
Second: not false
--> true
So,the input is true
42 == "any_string"
is a conditional statement.
So,not 42 == "any_string"
will judge the 42 == "any_string"
firstly,
just like if 42 == "any_string"
.