Please consider the following code:
i = [1, 2, 3, 5, 8, 13] j = [] k = 0 for l in i: j[k] = l k += 1 print j
The output (Python 2
Do j.append(l) instead of j[k] = l and avoid k at all.
j.append(l)
j[k] = l
k