I have got 2 lists:
A=[0, 1, 2, 3, 4] and B=[3, 2, 5, 2, 4] and would like to repeat every ith element of A B[i] times, so for given lists it would be:
repA = [ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2, 3, 3, 4, 4, 4, 4] so now we have three 0, two 1, five 2 and so on. I found that duplicating solution but have no idea how to do it for different times (writen in B list)
Their code is like [ item for item in list for _ in range(repetition) ]