Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a = 0
- SMAlist = []
- for each_item in y:
- if a > 4 and a < ((len(y))-1): # finding my averages begin at 6th item
- b = (y[a-5:a+1]) # this line doesn't work for the last item in y
- SMAsix = round((sum(b)/6),2)
- SMAlist.append(SMAsix)
- if a > ((len(y))-2): # this line seems unnecessary. How can I avoid it?
- b = (y[-6:-1]+[y[a]]) # Should I just use negative values in general?
- SMAsix = round((sum(b)/6),2)
- SMAlist.append(SMAsix)
- a = a+1
Add Comment
Please, Sign In to add comment