Course 5, week 1, assignment 2, sample()

I am hitting an error about the append. In the previous assignments, it works well, but why it shows an error like this?

1 Like

Maybe there is no variable named “indices” in your code.

Hi TMosh,

I think the variable ‘indices’ was defaultly defined by the notebook as an empty list.


You are correct. And there is nothing wrong with this line of code:

The syntax error is probably caused by a previous line of code.

@Chitoooo , did you find the problem by now?
I encounter exactly the same error message and don’t have any idea where it is coming from.

That type of syntax error most commonly means that there is something incomplete about the previous line of code: e.g. a missing close parenthesis.