Skip to content

Commit

Permalink
Update checker.py
Browse files Browse the repository at this point in the history
Use the built-in function next instead of a for-loop (use-next)
  • Loading branch information
ikostan committed Dec 13, 2024
1 parent e132d9d commit 079dcda
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions kyu_5/tic_tac_toe_checker/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,4 @@ def check_rows(board: list) -> int | None:
:param board: list
:return: 1, 2, or None
"""
for row in board:
if len(set(row)) == 1:
return row[0]
return None
return next((row[0] for row in board if len(set(row)) == 1), None)

0 comments on commit 079dcda

Please sign in to comment.