I have this small code code which is generating one element at every iteration. There is also one label being generated for each element.
count = 0
while (count<10):
random.seed()
tau = int(math.ceil(np.random.uniform(lorange, hirange)))
count = count+1
print('For', count,'th iter tau is', tau)
X = [amplitude * np.exp(-t / tau)]
print('And X is', X)
This gives me -
For 1 th iter tau is 253
And X is [-8.3319888120435905]
For 2 th iter tau is 733
And X is [-8.5504619226105234]
For 3 th iter tau is 6
And X is [-1.637157007733484]
For 4 th iter tau is 35
And X is [-6.5137386619958191]
For 5 th iter tau is 695
And X is [-8.544086302536952]
For 6 th iter tau is 987
And X is [-8.5805340921808924]
For 7 th iter tau is 807
And X is [-8.5611651675760001]
For 8 th iter tau is 820
And X is [-8.5628471889130697]
For 9 th iter tau is 799
And X is [-8.5601030426343065]
For 10 th iter tau is 736
And X is [-8.5509374123154984]
Now I want to get a list a list containing all the X values.
I checked the stack question here and did this-
myList = []
myList.append([X for _ in range(no_tau)])
print(myList)
But instead of getting all the X elements as a list, I am getting same element (the last X value) for multiple times.
[[[-8.5509374123154984], [-8.5509374123154984], [-8.5509374123154984], [-8.5509374123154984], [-8.5509374123154984], [-8.5509374123154984], [-8.5509374123154984], [-8.5509374123154984], [-8.5509374123154984], [-8.5509374123154984]]]
How can I get all the X elements in list instead of the same ones multiple times?
Also I want to later write this list in .csv format. Any help will be appreciated. Thanks