I have a list
A = [1,6,3,8,5,5,2,1,2,10]
I want to repeat the numbers in this like:
A = [1,6,6,6,6,6,6,3,3,3,8,8,8,8,8,8,8,8,..... so on]
i.e 1 repeat once, 6 repeat six times, 3 repeat thrice and so on....
I tried with:
B=np.concatenate([([x]*x) for x in A], axis=0)
but it multiplying the corresponding number and I am getting this result:
B = [1,36,36,36,36,36,36,9,9,9,.....so on]
when I am doing:
B=np.concatenate([([x]*3) for x in A], axis=0)
this giving me:
B = [1,1,6,6,3,3,8,8... so on]
what wrong I am doing here?