From a5583e41290b321207542876287f9b07dcd375ec Mon Sep 17 00:00:00 2001 From: Koleh David Date: Thu, 6 Feb 2025 15:03:12 +1030 Subject: [PATCH] r extract var --- gilded_rose.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/gilded_rose.py b/gilded_rose.py index 36c1bc3f..dac3083c 100755 --- a/gilded_rose.py +++ b/gilded_rose.py @@ -9,10 +9,9 @@ class Item: def update_item(item: Item): - if ( - item.name != "Aged Brie" - and item.name != "Backstage passes to a TAFKAL80ETC concert" - ): + is_aged_brie = item.name == "Aged Brie" + + if not is_aged_brie and item.name != "Backstage passes to a TAFKAL80ETC concert": if item.quality > 0: if item.name != "Sulfuras, Hand of Ragnaros": item.quality = item.quality - 1 @@ -29,7 +28,7 @@ def update_item(item: Item): if item.name != "Sulfuras, Hand of Ragnaros": item.sell_in = item.sell_in - 1 if item.sell_in < 0: - if item.name != "Aged Brie": + if not is_aged_brie: if item.name != "Backstage passes to a TAFKAL80ETC concert": if item.quality > 0: if item.name != "Sulfuras, Hand of Ragnaros":