Skip to content

Commit 3c91c29

Browse files
MaratSafiullinYabbleMarat
andauthored
modify solution and tests (#335)
Co-authored-by: Marat <marat@yabblezone.net>
1 parent 909f6d5 commit 3c91c29

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

modules/50-loops/29-edge-cases/index.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ def is_arguments_for_substr_correct(string, index, length):
33
return False
44
elif length < 0:
55
return False
6-
elif index > len(string) - 1:
7-
return False
86
elif index + length > len(string):
97
return False
108
return True

modules/50-loops/29-edge-cases/test_code.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33

44
def test1():
55
string = "Sansa Stark"
6-
end = len(string) - 1
6+
end = len(string)
77
assert not index.is_arguments_for_substr_correct(string, -1, 0)
88
assert not index.is_arguments_for_substr_correct(string, 0, -1)
99
assert not index.is_arguments_for_substr_correct(string, end + 1, 0)
10-
assert not index.is_arguments_for_substr_correct(string, end, 5)
11-
assert index.is_arguments_for_substr_correct(string, end, 1)
10+
assert not index.is_arguments_for_substr_correct(string, end, 1)
11+
assert index.is_arguments_for_substr_correct(string, end, 0)
12+
assert index.is_arguments_for_substr_correct(string, end - 1, 1)
1213
assert index.is_arguments_for_substr_correct(string, 3, 3)
1314
assert index.is_arguments_for_substr_correct(string, 0, 3)
1415
assert index.is_arguments_for_substr_correct(string, 0, 1)

0 commit comments

Comments
 (0)