Python List Comprehensions
>>> sqr = []
>>> for i in range(10):
sqr.append(i**2)
>>> sqr
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
Combination
comb = []
>>> for i in [1, 5, 3]:
for j in [2,1,5]:
if i!=j:
comb.append((i,j))
>>> comb
[(1, 2), (1, 5), (5, 2), (5, 1), (3, 2), (3, 1), (3, 5)]