diff --git a/modules/50-loops/29-edge-cases/index.py b/modules/50-loops/29-edge-cases/index.py index a40f1c30..47c8d339 100644 --- a/modules/50-loops/29-edge-cases/index.py +++ b/modules/50-loops/29-edge-cases/index.py @@ -3,8 +3,6 @@ def is_arguments_for_substr_correct(string, index, length): return False elif length < 0: return False - elif index > len(string) - 1: - return False elif index + length > len(string): return False return True diff --git a/modules/50-loops/29-edge-cases/test_code.py b/modules/50-loops/29-edge-cases/test_code.py index 8e914a81..c44d1736 100644 --- a/modules/50-loops/29-edge-cases/test_code.py +++ b/modules/50-loops/29-edge-cases/test_code.py @@ -3,12 +3,13 @@ def test1(): string = "Sansa Stark" - end = len(string) - 1 + end = len(string) assert not index.is_arguments_for_substr_correct(string, -1, 0) assert not index.is_arguments_for_substr_correct(string, 0, -1) assert not index.is_arguments_for_substr_correct(string, end + 1, 0) - assert not index.is_arguments_for_substr_correct(string, end, 5) - assert index.is_arguments_for_substr_correct(string, end, 1) + assert not index.is_arguments_for_substr_correct(string, end, 1) + assert index.is_arguments_for_substr_correct(string, end, 0) + assert index.is_arguments_for_substr_correct(string, end - 1, 1) assert index.is_arguments_for_substr_correct(string, 3, 3) assert index.is_arguments_for_substr_correct(string, 0, 3) assert index.is_arguments_for_substr_correct(string, 0, 1)