triangle_type(a, b, c) that first checks whether the three side lengths form a valid triangle (see triangle inequality). If invalid, return "Not a triangle". Otherwise return "Equilateral" if all three sides are equal, "Isosceles" if exactly two sides are equal, or "Scalene" if all sides differ.triangle_type(5, 5, 5)
"Equilateral"
All sides equal and forms a valid triangle.
triangle_type(5, 5, 8)
"Isosceles"
Two sides equal, valid triangle.
triangle_type(1, 1, 5)
"Not a triangle"
1+1 is not greater than 5.
Validate the triangle inequality before classifying the type.
Count how many of the three pairwise equalities hold, or compare directly with nested ifs.