I've been trying to write a program that determines if three lines can make a triangle or not. However, the code I have written does not work and I can not seem to determine why. It is currently producing 'no' for any inputs.(Note: The largest side has to be smaller then the sum of the other two sides in order to make a triangle)
My code:
def is_triangle(a,b,c):
if a >= b and a >= c and (b + c) >= a:
return print('yes')
elif b >= c and b >= a and (a + c) >= b:
return print('yes')
elif c >= a and c >= b and (a + b) >= c:
return print('yes')
else:
return print('no')
def input_triangle():
a = input('first side?')
b = input('second side?')
c = input('third side?')
return is_triangle(a,b,c)
input_triangle()