From 6a2b181bdd1828ea9c9fba10686aca7d6f9a9298 Mon Sep 17 00:00:00 2001 From: WIPocket Date: Mon, 4 Apr 2022 10:56:05 +0200 Subject: [PATCH] Fix __mul__ --- lib.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib.py b/lib.py index 3b9a23b..b456db9 100644 --- a/lib.py +++ b/lib.py @@ -13,12 +13,12 @@ class Pixel(namedtuple('Pixel', ['r', 'g', 'b'])): self.b + other.b, ) def __mul__(self, other): - if not isinstance(other, int) or not isinstance(other, float): + if not isinstance(other, int) and not isinstance(other, float): raise ValueError('Can only multiply by number') return Pixel( - other*pixel.r, - other*pixel.g, - other*pixel.b, + other*self.r, + other*self.g, + other*self.b, ) def weighted_average(p1, w1, p2, w2):