>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.

>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)

Right now your output is:
[1, 1, 1.5]
[1, 2, 1.5, 2.5]
[1, 3, 1.5, 2.5, 3.5]
[1, 4, 1.5, 2.5, 3.5, 4.5]
[1, 5, 1.5, 2.5, 3.5, 4.5, 5.5]
[1, 6, 1.5, 2.5, 3.5, 4.5, 5.5]

What do you want it to be?
This email is confidential and may be subject to privilege. If you are not the 
intended recipient, please do not copy or disclose its content but contact the 
sender immediately upon receipt.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to