I have two lists and I'm trying to create multiple copies of numbers based on how many times they occur.
numbers = [0, 1, 2]
amount = [1, 2, 3]
I tried:
total = []
n = 0
for i in range(len(numbers)):
product = numbers[n] * amount[n]
n += 1
total.extend(product)
But I got the error:
TypeError: 'int' object is not iterable.
My expected output is:
total = [0, 1, 1, 2, 2, 2]