Fundamentals
Strings
Fundamentals
Strings
class Triangle: def other_angle(a, b): return 180 - (a + b) def triangle_type_angle(a, b, c): if all( angle < 90 for angle in (a, b ,c)): return "Acute Triangle" if any(angle == 90 for angle in (a, b, c)): return "Right Triangle" return "Obtuse Triangle" def triangle_type_sides(s1, s2, s3): if s1 == s2 == s3: return "Equilateral Triangle" elif s1 == s2 or s2 == s3 or s1 == s3: return "Isoceles Triangle" return "Scalene Triangle"
- class Triangle:
def __init__(a, b, c, s1, s2, s3):self.a = aself.b = bself.c = cself.s1 = s1self.s2 = s2self.s3 = s3- def other_angle(a, b):
- return 180 - (a + b)
- def triangle_type_angle(a, b, c):
- if all( angle < 90 for angle in (a, b ,c)):
- return "Acute Triangle"
- if any(angle == 90 for angle in (a, b, c)):
- return "Right Triangle"
- return "Obtuse Triangle"
- def triangle_type_sides(s1, s2, s3):
- if s1 == s2 == s3:
- return "Equilateral Triangle"
- elif s1 == s2 or s2 == s3 or s1 == s3:
- return "Isoceles Triangle"
- return "Scalene Triangle"