I am doing an coding exercise using Python and obtain values from a csv.file. My questions on the assignment is to:
“Calculate the average change in “Profit/Losses” between months over the entire period.”

I know in my head to get this answer mathematically the formula would be something like “Average change in profit_loss = (Amount of last row - Amount of first row) / (Total length - 1)”

I’m getting an error message on not defining the variables. If I used last row and first row as my variable. What would it be equal too? I’m using the values from this csv file.

Well I have read the csv.file into my python and I see my fields. But I’m lost on defining variables. For example. I had a question which asked “Calculate the total months in the dataset?” So I defined a variable as “totalNetAmount = 0”, I wrote my script as “total_months = total_months + 1”. I printed my script and it came back with my value
I’m just not sure when I’m trying to calculate value in the same row, how do I define the variables i will use in my script