|
@@ -1,3 +1,80 @@
|
|
|
+
|
|
|
+class Person:
|
|
|
+ def __init__(self, name, age):
|
|
|
+ self.name = name
|
|
|
+ self.age = age
|
|
|
+
|
|
|
+ def display_person_info(self):
|
|
|
+ print(f"Person: {self.name}, {self.age}")
|
|
|
+
|
|
|
+class Company:
|
|
|
+ def __init__(self, name, city):
|
|
|
+ self.company_name = name
|
|
|
+ self.location = city
|
|
|
+
|
|
|
+ def display_company_info(self):
|
|
|
+ print(f"Company: {self.company_name}, {self.location}")
|
|
|
+
|
|
|
+class Employee:
|
|
|
+ def __init__(self, name, age, company, city):
|
|
|
+ self.personal_data = Person(name, age)
|
|
|
+ self.work = Company(company, city)
|
|
|
+
|
|
|
+# ````````````````````````````````````````````````````````````````
|
|
|
+
|
|
|
+class Task:
|
|
|
+ def __init__(self, name, description, status=False):
|
|
|
+ self.name = name
|
|
|
+ self.description = description
|
|
|
+ self.status = status
|
|
|
+
|
|
|
+ def display(self):
|
|
|
+ print(f"{self.name} {'(Сделана)' if self.status else '(Не сделана)'}")
|
|
|
+
|
|
|
+class TaskList:
|
|
|
+ def __init__(self):
|
|
|
+ self.tasks = []
|
|
|
+
|
|
|
+ def add_task(self, task: Task):
|
|
|
+ self.tasks.append(task)
|
|
|
+
|
|
|
+ def remove_task(self, task: Task):
|
|
|
+ self.tasks.remove(task)
|
|
|
+
|
|
|
+class TaskManager:
|
|
|
+ def __init__(self, task_list:TaskList):
|
|
|
+ self.task_list = task_list
|
|
|
+
|
|
|
+ def mark_done(self, task:Task):
|
|
|
+ task.status = True
|
|
|
+
|
|
|
+ def mark_undone(self, task:Task):
|
|
|
+ task.status = False
|
|
|
+
|
|
|
+ def show_tasks(self):
|
|
|
+ for task in self.task_list.tasks:
|
|
|
+ task.display()
|
|
|
+
|
|
|
+# ````````````````````````````````````````````````````````````````
|
|
|
+class Triangle:
|
|
|
+ def __init__(self, a, b, c):
|
|
|
+ self.a = a
|
|
|
+ self.b = b
|
|
|
+ self.c = c
|
|
|
+ def is_exists(self):
|
|
|
+ return (self.a < (self.b + self.c)) and \
|
|
|
+ (self.b < (self.a + self.c)) and \
|
|
|
+ (self.c < (self.a + self.b))
|
|
|
+
|
|
|
+ def is_equilateral(self):
|
|
|
+ return self.a == self.b == self.c
|
|
|
+
|
|
|
+ def is_isosceles(self):
|
|
|
+ return self.is_exists() and ((self.a == self.b) or (self.a == self.c) or (self.b == self.c))
|
|
|
+
|
|
|
+
|
|
|
+# ````````````````````````````````````````````````````````````````
|
|
|
+
|
|
|
class Config:
|
|
|
pass
|
|
|
|
|
@@ -14,8 +91,13 @@ def create_instance(number: int):
|
|
|
|
|
|
|
|
|
def main():
|
|
|
- config = create_instance(3)
|
|
|
- print(config.__dict__)
|
|
|
+ # config = create_instance(3)
|
|
|
+ # print(config.__dict__)
|
|
|
+
|
|
|
+ triangle = Triangle(5, 16, 5)
|
|
|
+ print(f"Is Triangle exist: {triangle.is_exists()}")
|
|
|
+ print(f"Is Equilateral: {triangle.is_equilateral()}")
|
|
|
+ print(f"Is Isosceles: {triangle.is_isosceles()}")
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|