[Tutor] I Need Help
Micheal Emeagi
michealemeagi at gmail.com
Wed Aug 24 06:26:07 EDT 2016
Hello Tutor,
I am a newbie programmer trying to implement an exponential smoothing
forcast using two list. Yt list has the Y values and Ft list has the
forcast values. Ft is the forcast list whose length should be one element
greater than the Yt list. I want the elements of ft to increment by one
while I use it to generate the subsequent element. But for some reasons I
don't understand, it keeps changing the second element in Ft.
Could please help me figure what is going wrong with the while iteration.
See below the code.
Michael
yt = [1,2,3,4,5,6]
ft = [yt[0],yt[0]]
alpha = 0.5
while len(ft) != len(yt) + 1:
ft.append(ft[1] + alpha * (yt[1] - ft[1]))
print(ft)
ft[1] += 1
yt[1] += 1
print (ft)
More information about the Tutor
mailing list