Can anyone shed some light on why it is not accepting my code? When I run the function I get the right answer, which is -20.
def double_index(lst, index):
if index < len(lst):
return lst[index] * 2
The solution insists on re-defining list[index] as the formula like so:
lst[index] = lst[index] * 2
but I don’t understand why this is necessary. Why can’t I just return the formula? The answer is the same.