From cf6d493914bc6fbb89eed2741dfc3834836f78ce Mon Sep 17 00:00:00 2001 From: Seongbeom Park Date: Sun, 24 Apr 2022 05:12:48 +0900 Subject: [PATCH] check sum is odd Verifying solution... Test 1 passed! Test 2 passed! Test 3 failed [Hidden] Test 4 failed [Hidden] Test 5 failed [Hidden] --- extra/distract-the-trainers/solution.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extra/distract-the-trainers/solution.py b/extra/distract-the-trainers/solution.py index a3f3918..0d12d81 100644 --- a/extra/distract-the-trainers/solution.py +++ b/extra/distract-the-trainers/solution.py @@ -24,6 +24,8 @@ def generate_trainer_pairs(trainer_id_list): yield [(first_id, second_id)] + pairs def check_loop(x, y): + if (x + y) % 2 == 1: # sum is odd + return True a, b = x, y memo = [] while a != b: @@ -38,6 +40,7 @@ def check_loop(x, y): return False tests = [ + ([1], 1), ([1, 1], 2), ([1, 7, 3, 21, 13, 19], 0), ]