Python 'list.insert()' only saves the last result of calculation loop
Your problem is that you are using insert
instead of append
and the main difference that insert takes a second argument for the position that you want to insert your element at and when none is provided it is 0 by default so you are consistently inserting at the same index resulting in a list with only the last element at the first position.
To fix that simply use append
instead.
else:
d = (geometric_mean(y)*1000000*12)
print(d)
list_1.append(d)