# Please Tell why is this WRONG

``````a,b,c = [int(i) for i in input().split()]
if (a+b<c) or (b+c<a) or (a+c<b):
print(-1)

elif (a==b==c) and ((a+b>c) or (b+c>a) or (a+c>b)):
print(1)
elif ((a==b and b!=c) or (a==c and c!=b) or (b==c and c!=a)) and ((a+b>c) or (b+c>a) or (a+c>b)):
print(2)
elif ((a+b>c) or (b+c>a) or (a+c>b)) and (a!=b and b!=c and c!=a):
print(3)
``````

Check what you get for this input:

``````5 9 4
``````

… it should give `-1`.

As a general point, you need to trust the `elif` mechanism - for example, if you establish in the first test that the triangle is non-viable, subsequent clauses do not need to retest this. Here additionally your extra tests are meaningless because this expression

``````((a+b>c) or (b+c>a) or (a+c>b))
``````

is always `True` no matter what `a,b,c` are.

1 Like

YEah they are meaningless, but still the outputs are correct aight?

I already gave you a test case that your code gets wrong. Here it is again:

``````5 9 4
``````

should produce `-1`

Re-testing known conditions clutters your code and is harder to review and find problems in.

1 Like

Thanks!