cs/practical-file/answers/question_16.py

10 lines
477 B
Python

# Question: Write a Python program to accept three sides and check whether they form a valid triangle.
side1 = float(input("Enter the length of the first side: "))
side2 = float(input("Enter the length of the second side: "))
side3 = float(input("Enter the length of the third side: "))
if (side1 + side2 > side3) and (side1 + side3 > side2) and (side2 + side3 > side1):
print("The sides form a valid triangle.")
else:
print("The sides do not form a valid triangle.")