No solution to C1M1 grading issue

Continuing the discussion from Issue with grading of C1M1 assignment:

I am using the correct code and getting the expected outcomes in the 2nd and 3rd assignment, but when graded, it indicates the wrong code. I am suspecting that the browser (Safari) I am using could be the problem, owing to the fact that I cannot enter any text in the Test your code box. See attached screenshot. Any ideas to help me.

Hi @davediehl ,

Test cells are locked, protecting from editing. Could you please post a screenshot of the error reported to help with the diagnosis. Below is an extract guideline for your information:

INSTRUCTIONS FOR ATTEMPTING THE ASSIGNMENT:

  • Before starting each exercise, read the instructions carefully. Look for the part called Your Task, it tells you exactly what you need to code and gives you all the details you need.

  • In each exercise cell, look for comments ### START CODE HERE ### and ### END CODE HERE ###. These show you where to write your code. Do not add or change any code that is outside these comments, or add any extra code cells in the notebook.

  • After you finish coding an exercise, there will be a test section that checks your work using a function called test_your_code. If everything is correct, you’ll see a message saying “All tests passed!” and you can move on. If there’s a mistake, you’ll see a red message explaining what went wrong, so you can fix it.

  • Before submitting your notebook for grading, ensure ALL exercises are complete (gotten All tests passed! for all of them). Save your work by clicking the :floppy_disk: icon at the top left, then click the Submit assignment button at the top right.

If your error message is similar to the one on the other thread you linked (about one of the test functions being undefined), I recently saw an instance of that grader error in another course on the DeepLearning.AI Learning Platform and it was caused by the student having merged code from a test cell into one of the graded cells. That can cause the grader to fail because it doesn’t just execute all the cells of the notebook (including the ones that import the unit test functions). It apparently extracts the graded cells and runs them in a different environment than the notebook.

Thanks, I must be doing something wrong in using the python tool. I know the code for the two exercises that fail because I get the expected output. Is there a way to clear the assignment and start from scratch? I’m attaching the error messages screenshot.

There are three other reports on the Forum of issues similar to yours, so maybe it’s a problem with the course.

I’m trying to locate who can investigate this.

Yes, please see this thread.

Thanks.

Update: I have pinged the DL.AI staff for this course.

Hi @davediehl ,

The print statement syntax for these exercises is restricted in the sense that there should not be any space between the print and the open round bracket. Here is an example:

print(

Thanks. That is the way I wrote and submitted the code. The thing is, when I run the code I get the correct, expected output. The grading function for some reason gives an error message that it should not (I checked the code I submitted using another AI tool). I’m baffled.

The grader is much more picky about syntax than the Python standard.

In Python you can have a space between print and (…). The grader doesn’t like it.

The reason this happens is that the grader doesn’t just run your notebook. For some of the tests, where it checks the syntax, It scans your notebook, looks for specific text patterns.

“print (” is not a pattern it allows.

As far as I can tell, my code is correct when I submit, validated by the output that matches the test standard (the “expected output”).

The grader does not use the results from the test cases that are included in the notebook.
It runs a totally different set of tests - and it includes scanning the actual text of the code you have added.

I don’t understand. I’m submitting the correct code and it’s not recognizing it.

Please check your personal messages for instructions how to proceed.

Hi @davediehl,

I have pointed out a few things in your other message. Please take look.

Thanks for. your advice. I started a new notebook and tried again.

I got 0/30 and got the messages below. I have know idea what I did wrong, or what went wrong. I have attached the .ipynb file.

My mind is fried after all this, so I might just go back to the beginning and do the Module all over again.

Any advice will be appreciated.

Exercise 1

0/10

There was a problem compiling the code from your notebook, please check that you saved before submitting. Details: f-string: invalid syntax. Perhaps you forgot a comma? (, line 36)

Exercise 2

0/10

There was a problem compiling the code from your notebook, please check that you saved before submitting. Details: f-string: invalid syntax. Perhaps you forgot a comma? (, line 36)

Exercise 3

0/10

There was a problem compiling the code from your notebook, please check that you saved before submitting. Details: f-string: invalid syntax. Perhaps you forgot a comma? (, line 36)

Hi @davediehl ,

There are a couple of issues with your code:

  1. NameError: name ‘test_your_code’ is not defined
    this is due to the fact that you have not run the first code cell that contains import test_your_code. Every time you run your code after a period of idling, you must run your code from the first code cell.

  2. you have not read the instruction on how to implement ex1B - using f string with variable for print statement. What you did was using the name of the book without quotation marks, which is not variable name. Please refer to previous code cell on variables.