# Checking Triangle Possibility with Given Angles in Python

Triangles are fundamental geometric shapes, and they have interesting properties, especially regarding their angles. In this blog post, we’ll explore a Python program that determines whether a triangle with positive area is possible based on the given angles. We’ll delve into the mathematical conditions and provide a clear explanation of the logic used in the program.

## Understanding the Problem

For a triangle to exist, the sum of its three interior angles must be equal to 180 degrees. The given problem involves checking whether a triangle with positive area is possible based on three input angles. We’ll use this fundamental geometric principle to create a Python program that assesses triangle possibility.

## Python Program Code

Let’s dive into the Python code that addresses the problem:

```
def is_triangle_possible(angle1, angle2, angle3):
# Check if the sum of angles is 180 degrees
if angle1 + angle2 + angle3 == 180:
# Check if all angles are greater than 0
if angle1 > 0 and angle2 > 0 and angle3 > 0:
return True
return False
# User input for angles
angle1 = int(input("Enter the first angle: "))
angle2 = int(input("Enter the second angle: "))
angle3 = int(input("Enter the third angle: "))
# Check and display result
result = is_triangle_possible(angle1, angle2, angle3)
if result:
print("A triangle with positive area is possible.")
else:
print("No triangle with positive area is possible with the given angles.")
```

## Program Output

Let’s consider an example where the user enters the angles: `60, 70, 50`

:

```
Enter the first angle: 60
Enter the second angle: 70
Enter the third angle: 50
A triangle with positive area is possible.
```

## Program Explanation

**User Input:**The program starts by taking user input for three angles representing a triangle.**Sum of Angles Check:**It checks if the sum of the entered angles is equal to 180 degrees, a requirement for any triangle.**Positive Angles Check:**Additionally, it verifies that all three angles are greater than 0 to ensure they are valid.**Result Display:**The program then displays whether a triangle with positive area is possible based on the given angles.

## Conclusion

This Python program leverages fundamental geometry principles to determine the possibility of a triangle with positive area based on user-input angles. Understanding geometric rules and applying them to programming problems enhances both mathematical and programming skills.

Readers are encouraged to experiment with different angle inputs, explore variations of the program, and consider additional geometric conditions for triangle validity. The ability to translate mathematical concepts into code is a valuable skill in various problem-solving scenarios. Happy coding!