Python Function to test for a valid triangle.

#Python Function to test for a valid triangle.


def IsTriangle(a,b,c):
	if(a+b>c and a+c>b and b+c>a):
		chk=1
	else:
		chk=0
	return chk
print("Enter 3 side of triangle A B C : ")
a = int(input()) 
b = int(input()) 
c = int(input()) 
find=IsTriangle(a,b,c)
if(find==1):
	print("\nValid triangle ")
else:
	print("\nInvalid triangle ")

Output :
Enter 3 side of triangle A B C :
5
6
6

Valid triangle



Leave a comment