Skip to content

Commit c666597

Browse files
committed
Update style.rst
1 parent a0f6fc1 commit c666597

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

docs/writing/style.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,7 @@ more concise syntax.
516516

517517
.. code-block:: python
518518
519+
a = [3, 4, 5]
519520
b = [i for i in a if i > 4]
520521
b = filter(lambda x: x > 4, a)
521522
@@ -525,10 +526,8 @@ more concise syntax.
525526
526527
# Add three to all list members.
527528
a = [3, 4, 5]
528-
count = 0
529-
for i in a:
530-
a[count] = i + 3
531-
count = count + 1
529+
for i in range(len(a)):
530+
a[i] += 3
532531
533532
**Good**:
534533

0 commit comments

Comments
 (0)