I don’t know how to handle this Python question and need guidance.
Hello I am trying to create a script index through a 3×7 csv table (see below).
| 0.9 | 0.5 | 0.5 |
| 0.9 | 0.9 | 0.5 |
| 0.5 | 0.5 | 0.9 |
| 0.9 | 0.9 | 0.9 |
| 0.9 | 0.5 | 0.9 |
| 0.5 | 0.9 | 0.9 |
| 0.5 | 0.9 | 0.5 |
goal here is to assign each values in every row as a1, a2, a3 then use the three values to calculate a product with a function (see below) :
def calculate_score(a1,a2,a3):
score = a1*2 + a2*3 + a3*4
return score
I was hoping to get a for loop to loop through the table (get a1, a2, a3 from each row and calculate with the calculate_score function above). Each row gives different a1,a2,a3 combinations, so the output of calculate_score should be slightly different.
Result of each row should be saved in a list or ndarray.
I attached my code below:
——————————————————————-


0 comments