I want to generate a list in python as follows -
[1, 1, 2, 4, 3, 9, 4, 16, 5, 25 .....]
You would have figured out, it is nothing but n,
Another option, might seem perverse to some
>>> from itertools import izip, tee
>>> g = xrange(1, 11)
>>> x, y = tee(g)
>>> y = (i**2 for i in y)
>>> z = izip(x, y)
>>> output = []
>>> for k in z:
... output.extend(k)
...
>>> print output
[1, 1, 2, 4, 3, 9, 4, 16, 5, 25, 6, 36, 7, 49, 8, 64, 9, 81, 10, 100]