Failed grade with all tests passed

This issue happens because you have defined key_topics dynamically using the response variable (for example, by parsing or splitting response inside the cell) instead of copy-pasting the topics as literal strings.

While this works locally in your active notebook session, the Coursera/deeplearning.ai autograder runs in a clean, sandboxed environment. In that environment, the cell that calls the LLM to define response is not marked as graded and is not executed. Furthermore, the autograder does not have internet access to run LLM API calls.

Because response is not defined in the grader’s environment, the cell for Exercise 2 fails to execute. This means the key_topics variable is never created, which causes the subsequent cells and the grader tests to throw the NameError: name 'key_topics' is not defined error. If any cell crashes during execution, the grader fails the entire submission and shows a score of 0.

You can check this community thread where @Mubsi resolved the exact same issue.

To fix this, copy the three topic strings generated by the LLM and paste them directly as string literals inside the list in Exercise 2:

key_topics = [
    ### START CODE HERE ###
    "Topic 1 text",
    "Topic 2 text",
    "Topic 3 text"
    ### END CODE HERE ###
]