C3_W2_RecSysNN_Assignment : Grading issue


I’ve completed the above assignment.

Within the assignment all tests were passed. However the assignment won’t complete the grading process. Would appreciate any help rectifying this.

I am getting the following error message:

Cell #5. Can’t compile the student’s code. Error: IndentationError(‘unexpected indent’, (‘/tmp/student_solution_cells/cell_5.py’, 8, 12, ’ )\n’))
Traceback (most recent call last):
File “/home/www/app/grading/exceptions.py”, line 112, in handle_solution_errors
yield {}
File “/home/www/app/grading/abstract.py”, line 393, in _grade
context = compiled_code.run(cell_index=cell.index)
File “/home/www/app/grading/submission/compiled_code.py”, line 195, in run
return list(self._code_items.values())[cell_num - 1].run()
File “/home/www/app/grading/submission/compiled_code.py”, line 54, in run
return import_module(self.import_statement, items)
File “/usr/local/lib/python3.7/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1006, in _gcd_import
File “”, line 983, in _find_and_load
File “”, line 967, in _find_and_load_unlocked
File “”, line 677, in _load_unlocked
File “”, line 724, in exec_module
File “”, line 860, in get_code
File “”, line 791, in source_to_code
File “”, line 219, in _call_with_frames_removed
File “/tmp/student_solution_cells/cell_5.py”, line 8
IndentationError: unexpected indent

Hello Andy @Andy6,

This error indicates that the function isn’t implemented correctly, but it is not uncommon. While it is your work to debug your code, we can provide some hints.

  1. Cell #5. Can’t compile the student’s code. This says your cell #5 has a problem.
  2. To find out which is cell #5, go to your notebook, click “Kernel” > “Restart & Run All”
  3. All code cells are then queued to run. As a cell finishes, a number will show up on the left like In [1].
  4. Wait until you see In [5], then that’s the cell #5. I expect you to see more an error traceback beneath the cell #5.
  5. You may or may not see this error message “IndentationError: unexpected indent”, but regardless of what message you see, google it to understand more.
  6. If you want to know how to indent correctly, you may check out this post.

Good luck!


Thanks for your response and the guidance re finding the cell with the error (that’ll be useful in future!)

Here’s what I found:

  • that cell was a pre-populated line of code that simply had to be run (no other user input).

  • the code in that cell had executed and OUT [5] was populated. There was no traceback error presented.

  • In my version the ) on the ‘pprint_train’ function had been dropped down to the next line. Perhaps I pressed the return key with out shift when I was running it originally…?

  • sorting that meant the grading completed when it was resubmitted.

Thanks again for your help.

So your work has passed the grader. Congratulations Andy!

I just want to point this out for future learners, that whenever they see an error message like Cell #5. Can’t compile the student’s code , it means something was wrong with the cell #5 in the assignment they had submitted.