From aba6057e1e91ac681a260160dddb486416396c3e Mon Sep 17 00:00:00 2001 From: Akmal Khamdullaev Date: Thu, 16 Oct 2025 19:57:57 +0300 Subject: [PATCH 1/2] homework_2_oop 16.1 done --- src/product.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/product.py b/src/product.py index 7d597c6..7795a9f 100644 --- a/src/product.py +++ b/src/product.py @@ -11,7 +11,7 @@ def __str__(self): return f"{self.name}, {self.price} руб. Остаток: {self.quantity} шт." def __add__(self, other): - if not isinstance(other, type(self)): + if type(self) is not type(other): raise TypeError("Нельзя складывать товары разных классов") return (self.price * self.quantity) + (other.price * other.quantity) From 7f56fdab0486c3ca051dfaae0e8cb64d6a670637 Mon Sep 17 00:00:00 2001 From: Akmal Khamdullaev Date: Thu, 16 Oct 2025 20:02:04 +0300 Subject: [PATCH 2/2] homework_2_oop 16.1 done --- src/product.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/product.py b/src/product.py index 7795a9f..8494cf1 100644 --- a/src/product.py +++ b/src/product.py @@ -11,7 +11,7 @@ def __str__(self): return f"{self.name}, {self.price} руб. Остаток: {self.quantity} шт." def __add__(self, other): - if type(self) is not type(other): + if type(self) is not type(other): #Исправил raise TypeError("Нельзя складывать товары разных классов") return (self.price * self.quantity) + (other.price * other.quantity)