Module 1 Assignment: Analyzing retail sales with Python - auto-grader not registering my answers

C3M1_Assignment
Module 1 Assignment: Analyzing retail sales with Python

I submitted this assignment several times but the grader is not able to grade any of my answers. The error for all exercises is:
“Unable to find object required for grading in your code.”

The Variable Inspector is showing all the variables with correct values and cell printouts match the expected printouts shown in the exercises.

I followed instructions to refresh the Coursera Jupyter Lab Environment

Started over and completed only exercise 1. In this exercise I have to complete only one line.
The line is:
num_observations =
the only thing I have to do is enter:
len(invoice_ids)
to complete the line:

GRADED CELL: Exercise 1

START CODE HERE

num_observations = len(invoice_ids)

END CODE HERE

print(num_observations)

The printout is 79.

I ran the rest of the cells in exercise 1 that require no more input from me and then submitted the assignment.

The grader output for “ex1: number of observations”:
“Unable to find object required for grading in your code.”

The Variable Inspector is showing:
NAME - num_observations
TYPE - int
SIZE - 28
CONTENT - 79

I am at a loss as to what to do next to be able to get this assignment graded.

Hi Orr, and welcome to the Forum! Did you rename your notebook by any chance? The grader will check the notebook with the original filename. If you didn’t, please send me your notebook via direct message. You can click my name then the blue Message button. Thanks.

Adding this reply I sent Chris for the record of this thread:

I renamed a previous version I worked on because it was in the instructions for refreshing the Coursera Jupyter Lab Environment but I deleted the renamed version and completed the new version with the same answers and had the same results of
“Unable to find object required for grading in your code.” for all exercises.

After seeing your reply I submitted the same notebook again just to try it once more before sending it to you and the grader gave it a full grade. The only difference was the few hours that passed.

1 Like

Hi, I am Having the same issue whereby, the auto grader only grades the first 5 exercise.

for exercise 6,7 and 8 it shows 0/10 even though i am 100% sure that i wrote the correct answers.

I have tried to save and update and submit many times and still shows the same thing.

Hi @AhmedAljaberi, welcome to the forum.
Can you share a print screen of the errors you’re getting from the grader?

C3M1_Assignment.ipynb (39.6 KB)

Here is my Assignment notebook.

Please note that , in Exercise 6 , i have changed it to

total_amount = sum(amounts)

Hi @AhmedAljaberi,

I am not able to check your notebook cell by cell, but I can tell you that some modifications usually perceived as ‘harmless’, might affect the grader.

For clarity, for this and all labs:

  • only modify where it says `None` in between the blocks `START CODE HERE` and `END CODE HERE`;

  • If you experience issues with the grader, you might also want to stop the kernel and run all your cells again, in order, because sometimes, the order affects the grader, and this is a known case with this specific lab, as discussed previously here.

  • In the link above, I shared some ways you can troubleshoot this notebook. For convenience, I am pasting them below this answer. If you decide to use this troubleshooting route, it’s also good to delete your ‘test cells’ before you submit the grader (I am sharing this from personal experience; if I submit with my ‘extra cells’ I have a problem, but if I just follow the instructions, I get full grade, as you can see from the screenshot below)

@AhmedAljaberi Here is the ‘troubleshoot route’ as shared here. I think your issue will problem be solved if you reset your notebook, and run the cells in order, as I commented above. Good luck :slight_smile:

Important notes:

  1. Your solution might match the ‘expected output’, but as Chris already explained, it’s important that you follow the instructions carefully to make sure the grader works. So, while in the real world you could use a function to calculate averages, for example, if the exercise asked you to use lists A and B, stick to the instructions.
  2. You need to run the cells for your notebook in order to be graded correctly. So once you finished all the exercises, run all the cells again, and after that, submit for grading.
  3. There’s a mistake in the ‘hints’ for exercise 5. You should iterate either over `range(num_observations)` or `range(len(prices_per_unit))`, and NOT OVER `range(num_observations-1)`.

With that said, here is a list of some possible ways to troubleshoot (you can run this once you finish the notebook).

  1. Lists are still lists
  • type(units_sold) should be list

  • type(prices_per_unit) should be list

  1. All lists have the same length
  • len(invoice_ids) == len(dates) == len(days_of_week) == len(product_names) == len(units_sold) == len(prices_per_unit)
  1. The appended record is present
  • invoice_ids[-1] == 536994

  • product_names[-1] == "CHRISTMAS CRAFT TREE TOP ANGEL"

  • units_sold[-1] == 2

  • prices_per_unit[-1] == 2.1

  1. Amounts is correctly formed
  • type(amounts) == list

  • len(amounts) == len(units_sold)

  • amounts[-1] == units_sold[-1] * prices_per_unit[-1] (should be 4.2)

  1. Exercise 6 outputs are numeric
  • type(total_amount) is float or int

  • type(average_price) is float

1 Like

Please do not share your notebook on the forum. That is not allowed by the Code of Conduct.

You were asked to just share a screen capture image of the error messages. That is always OK and a good idea.

I will unlist this thread, so it will only be visible to you and the course staff.

Afterward I will delete your notebook.

Tip:
Never add any cells to the notebooks. The grader does not handle that well.

May i know how to start over?

Yes.

This is from the course Resources topic.