If the three sides of a triangle are entered through the keyboard, write a Python program to check whether the triangle is valid or not. The triangle is valid if the sum of two sides is greater than the largest of the three sides.

print("Enter three sides of triangle: \n")
a = int(input())
b = int(input())
c = int(input())
if ((a + b > c) and (a + c > b) and (b + c > a)) :
	print("Triangle is valid.")
else :
	print("Triangle is not valid.")

Output :
Enter three sides of triangle:
Triangle is valid.

Leave a comment