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.
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 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.
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:
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 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.
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.
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)
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.
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.