Skip to content

Commit 963ab0a

Browse files
committed
Fix enumerate code snippet to run without error message
Code previously added numbers to strings, which results in a TypeError
1 parent d252d78 commit 963ab0a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/writing/style.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -548,11 +548,11 @@ keep a count of your place in the list.
548548
.. code-block:: python
549549
550550
for i, item in enumerate(a):
551-
print i + ", " + item
551+
print i, item
552552
# prints
553-
# 0, 3
554-
# 1, 4
555-
# 2, 5
553+
# 0 3
554+
# 1 4
555+
# 2 5
556556
557557
The ``enumerate`` function has better readability than handling a counter
558558
manually. Moreover,

0 commit comments

Comments
 (0)