Skip to content
I need help
Profile icon
FARHEENPALAGIRI

Hi everyone. Me again. I need help with a program I'm working on (as usual). So in this code there are two numbers inputted. If exactly one is negative, the program should print YES. If anything else is the input, the program should print NO. So I wrote this:

a = int(input())
b = int(input())

if a < 0:
print("YES")

elif b < 0:
print("YES")

elif a < 0 and b < 0:
print("NO")

else:
print("NO")

The computer seems to be ignoring the command of if both numbers are less than 0. Every time I input two number, the computer outputs YES instead of NO. How do I make it not do that? Help me please??

You are viewing a single comment. View All
Profile icon
FARHEENPALAGIRI

@safan41
Thanks :D