I have a variable x
. I need to create a list such as
lst=[0,x,x,2*x,2*x,3*x,3*x,N*x,N*x]
up to any N
Seems like this should be straightforward but I'm kinda stuck. Any help is appreciated.
Respectfully I don't see how this question is a duplicate
update....
So I did this.
import numpy as np
N=4
lst=[0]
x=1.2
for i in np.arange(1,N+1):
seed=[1,1]
for j in seed:
lst.append(i*x)
lst= [0, 1.2, 1.2, 2.3999999999999999, 2.3999999999999999, 3.5999999999999996, 3.5999999999999996, 4.7999999999999998, 4.7999999999999998]
It feels like a terrible hack.
There has to be a more elegant solution.