Skip to content

Commit

Permalink
Merge pull request #187 from Stegallo/sourcery/2015
Browse files Browse the repository at this point in the history
day5 (Sourcery refactored)
  • Loading branch information
Stegallo authored Nov 6, 2023
2 parents 6a78587 + 2e55579 commit a8ccba0
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 a8ccba0

Please sign in to comment.