Question: I'm trying to figure out how to manually enumerate a list however I'm stuck as I cannot figure out how to split up the `data` list. This is the code I have so far..

```
enumerated_list = []
data = [5, 10, 15]

for x in (data):
    print(x)

for i in range(len(data)):
    enumerate_rule = (i, x)
    enumerated_list.append(enumerate_rule)

print(enumerated_list)

```

This prints out..

```
5
10
15
[(0, 15), (1, 15), (2, 15)]

```

When what I'm after is `[(0, 5), (1, 15), (2, 15)]`. How would I go about this?

Answer: 
Since `x` goes through every element in `data, at the end of:

```
for x in (data):
    print(x)

```

`x` will be the last element. Which is why you get `15` as the second element in each tuple: 

```
[(0, 15), (1, 15), (2, 15)]

```

You only need one loop:

```
for i in range(len(data)):
    enumerate_rule = (i, data[i]) # data[i] gets the ith element of data
    enumerated_list.append(enumerate_rule)

```
Use [the `enumerate()` built-in](http://docs.python.org/3.3/library/functions.html#enumerate):

```
>>> list(enumerate([5, 15, 15]))
[(0, 5), (1, 15), (2, 15)]

```

Your original code's fault lies in the fact you use `x` in your loop, however, `x` doesn't change in that loop, it's simply left there from the previous loop where you printed values.

However, this method of doing it is a bad way. Fixing it would require looping by index, something which Python isn't designed to do - it's slow and hard to read. Instead, we loop by value. The `enumerate()` built-in is there to do this job for us, as it's a reasonably common task.

If you really don't want to use `enumerate()` (which doesn't ever really make sense, but maybe as an arbitrary restriction trying to teach you about something else, at a stretch), then there are still better ways:

```
>>> from itertools import count
>>> list(zip(count(), [5, 15, 15]))
[(0, 5), (1, 15), (2, 15)]

```

Here we use [`zip()`](http://docs.python.org/3.3/library/functions.html#zip), which is the python function used to loop over two sets of data at once. This returns tuples of the first value from each iterable, then the second from each, etc... This gives us the result we want when combined with [`itertools.count()`](http://docs.python.org/3.3/library/itertools.html#itertools.count), which does what it says on the tin.

If you really feel the need to build a list manually, the more pythonic way of doing something rather unpythonic would be:

```
enumerated_list = []
count = 0
for item in data:
    enumerated_list.append((count, item))
    count += 1

```

Note, however, that generally, one would use a [list comprehension](http://www.youtube.com/watch?v=pShL9DCSIUw) to build a list like this - in this case, as soon as one would do that, it makes more sense to use one of the earlier methods. This kind of production of a list is inefficient and hard to read.