Module 2 Graded Lab

Hi [Instructor/Support Team],

I’m running into repeated grading issues in the lab. Although my code produces correct results — including valid API responses and correctly named columns — the grader continues to fail my submissions. Below are the specific issues I encountered, along with my corresponding code for each exercise.


:white_check_mark: Exercise 1a

Grader error:

“It seems you did not load the API key from the environment variable. Expected: <class ‘str’>.”

My code:

python

CopyEdit

# GRADED CELL: Exercise 1a

import os
import requests
from dotenv import load_dotenv

BASE_URL = "https://2eraiuh.dlai.link/api/UScensus"

### START CODE HERE ###
# mentor edit: code removed - not allowed by the Code of Conduct
### END CODE HERE ###

This returns status code 200 and real data, confirming that the API key is loaded correctly as a string.


:white_check_mark: Exercise 7

Grader error:

“Object required for grading not found. The grader omits cells that throw errors.”

My code:

python

CopyEdit

# GRADED CELL: Exercise 7

### START CODE HERE ###
# mentor edit: code removed
### END CODE HERE ###

This code runs successfully, and the "priority_score" column appears in the DataFrame. However, the grader seems to ignore it.


:white_check_mark: Exercise 8

Grader error:

“[‘priority_score’] not found in axis”

My code:

python

CopyEdit

# GRADED CELL: Exercise 8

### START CODE HERE ###
# mentor edit: code removed
### END CODE HERE ###

This fails only because the grader cannot find the "priority_score" column — likely due to Exercise 7 not being detected as completed.


:receipt: Summary:

  • API calls return expected results.
  • Column names match the spec ("priority_score", not "priority score").
  • All output appears correct in the notebook, yet the grader fails due to environment or dependency issues.

I’d appreciate your help resolving this, or guidance on how to match the grader’s expectations more closely.

Thank you,
Anil

I successfully passed the exam, but item 1 is still failing. I would appreciate it if someone could review it and share their insights.

GRADED CELL: Exercise 1a

BASE_URL = "<link>"

START CODE HERE

# mentor edit: code removed

END CODE HERE

Failed test case: The keys in the params dictionary are correct, but the values do not match the expected ones.

While we wait for a course mentor to reply, I have edited your messages to remove the code you added.

Sharing your code on the forum is not allowed by the Code of Conduct.

Hey there!

When you have issues with “object not found”, it’s likely because something was changed in the notebook, so the scorer can no longer find it.
Anyway, reseting the notebook usually fix this issue.

You can follow the instructions here under the “Coursera Jupyter Lab Environment” section, in order to refresh your notebook.

Hi Anil. Just let us know if the issue persists so we can troubleshoot if this is a notebook or grader problem. Thanks!