Let's look from line 5. If the conditional in line 5 evaluates to
What you want (presumably) is
True
we enter that conditional block. Then if the conditional on line 6 evaluates to False
the program ends.What you want (presumably) is
and
, not a second nested if
:if (a + b) % 2 == 0 and (c + d) % 2 == 0: print("YES") elif (a + b) % 2 != 0 and (c + d) % 2 != 0: print("YES") else: print("NO")Also it seems it could be simplified to this:
if (a + b) % 2 == (c + d) % 2: print("YES") else: print("NO")As both of the first two conditionals are asking if they evaluate to the same thing.