From 2e55579cf927e51efc3c4ca647e66b5a62f64d39 Mon Sep 17 00:00:00 2001 From: Sourcery AI <> Date: Mon, 6 Nov 2023 23:07:36 +0000 Subject: [PATCH] 'Refactored by Sourcery' --- y_2015/day5.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/y_2015/day5.py b/y_2015/day5.py index 60bca16..cda1074 100644 --- a/y_2015/day5.py +++ b/y_2015/day5.py @@ -38,11 +38,9 @@ def nice(self) -> bool: def __has_pair_twice(self) -> bool: len_text = len(self.text) - for i in range(len_text - 2): - if self.text[i : i + 2] in self.text[i + 2 :]: - return True - - return False + return any( + self.text[i : i + 2] in self.text[i + 2 :] for i in range(len_text - 2) + ) def __has_letter_repeats_with_one_between(self) -> bool: return any(self.text[i] == self.text[i + 2] for i in range(len(self.text) - 2))