I have an array from which I only need value[1]
,value[4]
,value[7]
,value[10]
,value[13]
and value[16]
(so basically every third value after the skipping value[0]
).
I need to do an equation with each of these values and return each answer into an array. The function I've written is, however, not making jumps of 3 and instead using every value. How would I fix this?
popt=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18] #I only want to use popt[1],popt[4],popt[7] etc.
def d(popt):
dvalues=[]
i=1
for i in range(0, len(popt)//3):
d=wavelength()/(2 * math.sin(math.radians(popt[i] / 2)))
dvalues.append(d)
I+=3
return(dvalues)
print(d(popt))