-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
Closed as not planned
Description
Bug report
Bug description:
def nested_range_bug(self, word: str) -> int:
word_len: int = len(word)
for left in range(len(word) - 1, - 1, -1):
for index in range(1, min(10, word_len - left)):
return left
def test_my_word(self) -> None:
actual_left = self.nested_range_bug("band")
self.assertEqual(3, actual_left)
When using a nested range in two nested loops and the range in the inner loop is started at one, python skips processing of the the first iteration of the outer loop.
In the code example above, it's nested_range_bug is expected to return 3 but it returns 2 instead.
CPython versions tested on:
3.12
Operating systems tested on:
macOS
Metadata
Metadata
Assignees
Labels
No labels