You're given a tuple with 3 integers representing the three sides of a triangle. Based on the three sides you need to determine the type of triangle based on both angles and sides, i.e. Acute, Obtuse, or Right angled triangle along with Equilateral, Isosceles, or Scalene. See examples for more details.
Input: A single tuple containing three integer values.
Output: A string telling the type of triangle. First print the type of triangle based on the angles and then based on the sides. So if a triangle is, say, acute and scalene, you need to print 'Acute' on the first line and 'Scalene' on the second line. If the sides are such that a triangle cannot be formed, print 'Invalid'. You need to print the following strings for each of the cases:
Acute angled triangle: 'Acute'
Right angled triangle: 'Right'
Obtuse angled triangle: 'Obtuse'
Equilateral triangle: 'Equilateral'
Isosceles Triangle: 'Isosceles'
Scalene Triangle: 'Scalene'
(4, 9, 10)
(3, 8, 12)
Explanation: In the first example, the triangle is obtuse according to the angles and since the three sides are unequal, it is a scalene triangle.
In the second example, the 3 values are not satisfying the condition a+b < c, where c is the largest size. Hence, a triangle cannot be formed using these three sides which means the given input is 'Invalid'.
# Read the input list import ast,sys input_str = sys.stdin.read() t = ast.literal_eval(input_str) t = sorted(t) def side_func(t): if(t + t <= t): return('Invalid') elif(t == t and t == t): return('Equilateral') elif((t == t) or (t == t) or (t == t)): return('Isosceles') else: return('Scalene') def angle_func(t): if(t**2 == t**2 + t**2): return('Right') elif(t**2 < (t**2 + t**2)): return('Acute') else: return('Obtuse') side = side_func(t) angle = angle_func(t) if(side=='Invalid'): print(side) else: print(angle) print(side)