If RESULTHAZARD is 2, RESULTHAZARD == 2 or 3
evaluates to True or 3
which evaluates to True
. Otherwise, RESULTHAZARD == 2 or 3
evaluates to False or 3
which evaluates to 3
, which is a truthy value.
You need to explicitly compare both for equality. Either with RESULTHAZARD == 2 or RESULTHAZARD == 3
, or RESULTHAZARD in (2, 3)
.
For the !=
operator, either several checks connected with and
, or use not in
with the sequence of values of interest.
1
solved Returning wrong values with if in python in DEF() statement