We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e2d2609 commit 1ccc5edCopy full SHA for 1ccc5ed
iterator.py
@@ -4,8 +4,8 @@
4
def count_to(count):
5
"""Counts by word numbers, up to a maximum of five"""
6
numbers = ["one", "two", "three", "four", "five"]
7
- # The zip keeps from counting over the limit
8
- for number, pos in zip(numbers, list(range(count))):
+ # enumerate() returns a tuple containing a count (from start which defaults to 0) and the values obtained from iterating over sequence
+ for pos, number in enumerate(numbers):
9
yield number
10
11
# Test the generator
0 commit comments