I am a TA helping a student out with CS1101 and they had a very interesting question.
In python, why does it allow you to do this:
return data + [data[-1]]
But not:
return data.append(data[-1])
I know that you can do the second line with:
data.append(data[-1])
return data
But that doesn't answer my question on why the second statement doesn't work!
Thank you in advance and no this is not a homework question!