Fix enumerate code snippet to run without error message

Code previously added numbers to strings, which results in a TypeError
This commit is contained in:
Matthew Boehm
2013-07-28 10:20:47 -04:00
parent d252d7832f
commit 963ab0aabf
+4 -4
View File
@@ -548,11 +548,11 @@ keep a count of your place in the list.
.. code-block:: python
for i, item in enumerate(a):
print i + ", " + item
print i, item
# prints
# 0, 3
# 1, 4
# 2, 5
# 0 3
# 1 4
# 2 5
The ``enumerate`` function has better readability than handling a counter
manually. Moreover,