Failure during grading in spite of passing all tests

For the 2nd practice lab of first week(Anomaly Detection), I’m having an issue where my code runs perfectly and passes all the tests, but after submission, I receive a 0 as my grade, possibly due to a compile error or sth! Any suggestions on how to fix this?
Here is the error I receive while waiting to be graded:
“Cell #UNQ_C2. Can’t compile the student’s code. Error: IndentationError(‘expected an indented block’, (‘/tmp/student_solution_cells/cell_11.py’, 57, 10, ’ if F1 > best_F1:\n’))”
P.S. I checked and there was no indentation error!

An Indentation error is a compile-time error that occurs when tabs or spaces in a code do not follow expected patterns.

check in UNQC2 , if you have placed any codes incorrectly

Thanks for your response, but I re-indented the entire block, checked for mixed indentations and even tried “show whitespace” for a clear visualization…it doesn’t work!

This is the entire code block:posting codes is against community guidelines

Two thoughts:

  • The try/except block may be causing the problem. The grader might not like your exception trapping. It depends on exactly how the grader works (which the mentors are not fully informed about).

  • When you look at the code in your notebook, do any of the code lines have text in a red font?

I also thought the try/except might be causing an issue at some point, but faced the same error even without it. Also to answer your 2nd question, nothing in red except for the docstring which is irrelevant:))

I am curious why the docstring would be red. It should not be.

1 Like