From bc920dd5b87b0a3cedd0b0ed6d23c18c8b6b2461 Mon Sep 17 00:00:00 2001 From: ehermakov Date: Sun, 3 Sep 2023 11:55:50 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D1=8F=D1=8E=20=D0=BB?= =?UTF-8?q?=D0=B8=D1=88=D0=BD=D0=B8=D0=B5=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B?= =?UTF-8?q?=20=D1=81=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81=D0=B0=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../13082023 ДЗ по фигурам JSON/circle.py | 13 -------- .../13082023 ДЗ по фигурам JSON/rectangle.py | 17 ---------- .../13082023 ДЗ по фигурам JSON/shape.py | 31 ------------------- .../13082023 ДЗ по фигурам JSON/square.py | 12 ------- 4 files changed, 73 deletions(-) delete mode 100644 HNS/Excercises/13082023 ДЗ по фигурам JSON/circle.py delete mode 100644 HNS/Excercises/13082023 ДЗ по фигурам JSON/rectangle.py delete mode 100644 HNS/Excercises/13082023 ДЗ по фигурам JSON/shape.py delete mode 100644 HNS/Excercises/13082023 ДЗ по фигурам JSON/square.py diff --git a/HNS/Excercises/13082023 ДЗ по фигурам JSON/circle.py b/HNS/Excercises/13082023 ДЗ по фигурам JSON/circle.py deleted file mode 100644 index b89c84f..0000000 --- a/HNS/Excercises/13082023 ДЗ по фигурам JSON/circle.py +++ /dev/null @@ -1,13 +0,0 @@ -import math -from shape import Shape - - -class Circle(Shape): - def __init__(self, radius): - self.radius = radius - - def area(self): - return math.pi * (self.radius ** 2) - - def perimetr(self): - return 2 * math.pi * self.radius diff --git a/HNS/Excercises/13082023 ДЗ по фигурам JSON/rectangle.py b/HNS/Excercises/13082023 ДЗ по фигурам JSON/rectangle.py deleted file mode 100644 index 9d083bd..0000000 --- a/HNS/Excercises/13082023 ДЗ по фигурам JSON/rectangle.py +++ /dev/null @@ -1,17 +0,0 @@ -from shape import Shape - - -class Rectangle(Shape): - def __init__(self, width, height): - self.width = width - self.height = height - - def area(self): - return self.width * self.height - - def perimetr(self): - return (self.width + self.height) * 2 - - -r1 = Rectangle(10, 20) -print(r1.area()) diff --git a/HNS/Excercises/13082023 ДЗ по фигурам JSON/shape.py b/HNS/Excercises/13082023 ДЗ по фигурам JSON/shape.py deleted file mode 100644 index cb70176..0000000 --- a/HNS/Excercises/13082023 ДЗ по фигурам JSON/shape.py +++ /dev/null @@ -1,31 +0,0 @@ -from abc import abstractmethod -from abc import ABC - - -class Shape(ABC): - color = '' - - @abstractmethod - def area(self): - pass - - @abstractmethod - def perimetr(self): - pass - - @staticmethod - def create_shape(json): - if "type" in json: - shape_type = json["type"] - if shape_type == "circle": - return json["radius"] - elif shape_type == "square": - return json["side"] - elif shape_type == "rectangle": - return json["width"], json["height"] - else: - raise TypeError(f'Неизвестная фигура {shape_type}') - - - -print() \ No newline at end of file diff --git a/HNS/Excercises/13082023 ДЗ по фигурам JSON/square.py b/HNS/Excercises/13082023 ДЗ по фигурам JSON/square.py deleted file mode 100644 index b39b3d4..0000000 --- a/HNS/Excercises/13082023 ДЗ по фигурам JSON/square.py +++ /dev/null @@ -1,12 +0,0 @@ -from shape import Shape - - -class Square(Shape): - def __init__(self, side): - self.side = side - - def area(self): - return self.side ** 2 - - def perimetr(self): - return 4 * self.side