Skip to content

Commit

Permalink
Merge pull request #184 from Stegallo/sourcery/2015
Browse files Browse the repository at this point in the history
simplify day5 (Sourcery refactored)
  • Loading branch information
Stegallo authored Nov 6, 2023
2 parents 3718e83 + 970e4aa commit 198ad30
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions y_2015/day5.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,7 @@ def __has_pair_twice(self) -> bool:
return bool(twice_pair)

def __has_letter_repeats_with_one_between(self) -> bool:
letter_repeat = False
for i in range(len(self.text) - 2):
if self.text[i] == self.text[i + 2]:
letter_repeat = True
break
return bool(letter_repeat)
return any(self.text[i] == self.text[i + 2] for i in range(len(self.text) - 2))

@property
def correct_nice(self) -> bool:
Expand Down

0 comments on commit 198ad30

Please sign in to comment.