mediumUnit 4 · Control Flow: if-elif-else, match-case
P12. Triangle Classifier
Control Flow: if-elif-else, match-case
Read three side lengths. They form a triangle only if every side is positive and the sum of any two sides is greater than the third.
If they form a triangle, print its type: Equilateral (all sides equal), Isosceles (exactly two equal) or Scalene (all different). Then check whether it is right-angled: after sorting the sides, the square of the largest equals the sum of the squares of the other two.
Input Format
- Line 1: three integers separated by spaces
Output Format
- Line 1:
Equilateral,IsoscelesorScalene - Line 2:
Right-angledorNot right-angled - If the sides do not form a triangle, print only one line:
Not a triangle
Constraints
- -1000 ≤ each side ≤ 1000
Sample Test Cases
Sample 1
Input
3 4 5
Output
Scalene Right-angled
Sample 2
Input
5 5 5
Output
Equilateral Not right-angled
Submitting checks 2 sample cases and 5 hidden test cases.