I would like to show all the values of this loop in the tableview. The code is to calculate an Amortization Table for loans. I tried saving the data of the loop in the array, bu
The main issue is with your data array.
In your loop where you populate your data array, in tableCalculation
, there's this:
data = [interest]
It means that for each iteration you set the data array to [interest]
instead of appending the new item to the array.
What you should do instead:
data.append(interest)
Note that you make the same mistake with self.data2
. But now you know how to fix this kind of error.