From a9ff0ff050ed6f82271fa8f1354b1c6e40e20304 Mon Sep 17 00:00:00 2001 From: dherrada Date: Tue, 17 Mar 2020 17:06:57 -0400 Subject: [PATCH] simplified chained comparisons --- adafruit_ht16k33/segments.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_ht16k33/segments.py b/adafruit_ht16k33/segments.py index 20d903f..0f7aff7 100755 --- a/adafruit_ht16k33/segments.py +++ b/adafruit_ht16k33/segments.py @@ -243,7 +243,7 @@ class Seg14x4(HT16K33): else: places = len(stnum[:dot]) - if places <= 0 and decimal > 0: + if places <= 0 < decimal: self.fill(False) places = 4 @@ -251,7 +251,7 @@ class Seg14x4(HT16K33): places += 1 # Set decimal places, if number of decimal places is specified (decimal > 0) - if places > 0 and decimal > 0 and dot > 0 and (len(stnum[places:]) > decimal): + if places > 0 < decimal < len(stnum[places:]) and dot > 0: txt = stnum[: dot + decimal + 1] elif places > 0: txt = stnum[:places]