I have a large sequence related problem to solve for which following is sub problem, an I am sure its something very basic in python that I am not aware of.
seq = [4*x for x in range (1,(20/4))]
generates seq = [4, 8, 12, 16]
How can I generate
[4, 4, 8, 8, 12, 12, 16]
seq = [4*x, 4*x for x in range (1,(20/4))] does not work
I can easily solve above problem by writing a small function, but I require it at the variable definition time.
16meant to only be there once?... 4*x, 4*x ...I think that your solution would be correct.