Say I have this
b = 3
l = [1, 2]
I want to modify l so that each element appears as many times as b. So that:
l = [1, 1, 1, 2, 2, 2]
I used this:
for x in l:
for m in range(b):
l.append(x)
But it resulted in an infinite loop. Any help would be appreciated. I would prefer you guys to give ideas rather than give me the code. Thanks.