From 079dcda61716f0f00d9b84cd2658fb1751c9a6da Mon Sep 17 00:00:00 2001 From: Egor Kostan <20955183+ikostan@users.noreply.github.com> Date: Fri, 13 Dec 2024 14:15:13 -0800 Subject: [PATCH] Update checker.py Use the built-in function next instead of a for-loop (use-next) --- kyu_5/tic_tac_toe_checker/checker.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/kyu_5/tic_tac_toe_checker/checker.py b/kyu_5/tic_tac_toe_checker/checker.py index df7c94fceec..3cb71126682 100644 --- a/kyu_5/tic_tac_toe_checker/checker.py +++ b/kyu_5/tic_tac_toe_checker/checker.py @@ -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)