I am trying to write an equation for a nested for loop. i am getting an error and am trying to understand how to write it?
ysub = GPA
0 0.4509999999999996
1 -0.04900000000000038
2 -0.5490000000000004
3 0.20099999999999962
4 -0.4490000000000003
5 0.19099999999999984
6 0.4509999999999996
7 -0.5490000000000004
8 0.25099999999999945
9 0.05099999999999971
Code:
i = range (1,10,1)
m = range (1,10,1)
RMSEtest = ((1/m)*(ysub[i]^2))
we have to calculate RMSEtest (sum of values from m = 1 to 10) for each of the ysub values.
1/m
you're trying to divide the integer1
by therange
objectrange (1,10,1)
, which is not possible.ysub
from m = 1 to 10, then you could dosum(ysub[k] for k in m)