I am unable to produce any results with the following question:
Write a function named
append_sumthat has one parameter — a list named named
lst. The function should add the last two elements of
lsttogether and append the result to
lst. It should do this process three times and then return
lst. For example, if
[1, 1, 2], the final result should be
[1, 1, 2, 3, 5, 8].
Here is my code:
#Write your function here def append_sum(lst): a = lst[-1] + lst[-2] lst = lst.append(a) return lst #Uncomment the line below when your function is done print(append_sum([1, 1, 2]))
I know I am not producing the results three times here but I would think this would return something. Instead it returns “None”.