Python Program to Check if Triangle is Valid or Not using Angles
Write Python Program to Check if Triangle is Valid or Not using Angles
# Python Program to Check if Triangle is Valid or Not using Angles # get the angles of triangle angle1 = int(input("Enter Angle 1 :--> ")) angle2 = int(input("Enter Angle 2 :--> ")) angle3 = int(input("Enter Angle 3 :--> ")) total = angle1 + angle2 + angle3 print("Sum of Angles :--> ", total) if total == 180: print("Sum of angle is 180, so It is a Valid Triangle") else: print("Sum of Angle is not 180, so, It is an invalid Triangle")
Output:
Run 1:
Enter Angle 1 :--> 40
Enter Angle 2 :--> 50
Enter Angle 3 :--> 60
Sum of Angles :--> 150
Sum of Angle is not 180, so, It is an invalid Triangle
Run 1:
Enter Angle 1 :--> 50
Enter Angle 2 :--> 70
Enter Angle 3 :--> 60
Sum of Angles :--> 180
Sum of Angle is 180, so, It is a valid Triangle