[Tutor] I Need Help

Joaquin Alzola Joaquin.Alzola at lebara.com
Wed Aug 24 12:53:05 EDT 2016


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


More information about the Tutor mailing list