Skip to content

Commit 9e72c6d

Browse files
author
Galen Rice
authored
fix: "in the example", less terse and less confusing
1 parent 9c0f936 commit 9e72c6d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bot/resources/tags/loop-remove.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ print(data) # [2, 4] <-- every OTHER item was removed!
1212
```
1313
Inside the loop, an index tracks the current position. If the list is modified, this index may no longer refer to the same element, causing elements to be repeated or skipped.
1414

15-
Above, `1` is removed, shifting `2` to index *0*. The loop then moves to index *1*, removing `3` (and skipping `2`!).
15+
In the example above, `1` is removed, shifting `2` to index *0*. The loop then moves to index *1*, removing `3` (and skipping `2`!).
1616

1717
You can avoid this pitfall by:
1818
- using a **list comprehension** to produce a new list (as a way of filtering items):

0 commit comments

Comments
 (0)