Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Triangle:
- def __init__(self, a=0, b=0, c=0):
- self.a = a
- self.b = b
- self.c = c
- def specify_length(self):
- self.a = int(input("сторона a = "))
- self.b = int(input("сторона b = "))
- self.c = int(input("сторона c = "))
- def examination(self):
- bool = False
- if self.a + self.b > self.c and self.a + self.c > self.b and self.b + self.c > self.a:
- bool = True
- return bool
- def area_calculation(self):
- if self.examination():
- p = self.perimeter()/2
- return (p * (p - self.a) * (p - self.b) * (p - self.c)) ** 0.5
- else:
- return "Такого треугольника не существует!"
- def perimeter(self):
- if self.examination():
- return self.a + self.b + self.c
- else:
- return False
- t1 = Triangle(100,200,150)
- t1.specify_length()
- print(t1.examination())
- print(t1.area_calculation())
- print(t1.perimeter())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement