Skip to content

Commit

Permalink
'Refactored by Sourcery'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sourcery AI committed Nov 6, 2023
1 parent ad243cb commit 2e55579
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions y_2015/day5.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 2e55579

Please sign in to comment.