Hi There,
I am getting the following error:
Cell #20. Can’t compile the student’s code. Error: TypeError(“unsupported operand type(s) for +=: ‘NoneType’ and ‘NoneType’”)
I cant edit cell #20 in the notebook. It seems the notebook deny access to us to edit. Can someone help me with this?
Hello Megha,
is cell#20 grader code cell or the next cell to the code you wrote. Those cells cannot be edited until you go and change metadata setting.
But the error you are getting is either because you have left a None which needs to be written with the correct code.
Also make sure not to rename the notebook. Keep the name as default when you you downloaded or open the notebook to do the assignment.
Regards
DP
Hi Deepti,
Thank You for your reply.
The error is not pertaining the grader code cell(the cells in which we add our answers). I might need to change the metadata setting which I am not aware of. Kindly help me with that.
Test your predict code
np.random.seed(1)
tmp_w = np.random.randn(2)
tmp_b = 0.3
tmp_X = np.random.randn(4, 2) - 0.5
tmp_p = predict(tmp_X, tmp_w, tmp_b)
print(f’Output of predict: shape {tmp_p.shape}, value {tmp_p}')
UNIT TESTS
predict_test(predict)
The code ‘predict_test(predict)’ is not required here is what I understood.
Thanks, and Regards
Megha
Hello Megha,
I just checked the concerned cell you are mentioning which is perfectly correct.
When I asked you to share screenshot, I wanted you to share the screenshot of the error you got while running any of these test cells.
These test cells gives you error, if your codes are incorrect or have missed any part of the code for the test cell to pass.
Based on your error log from the first comment, it mentions there is a None left which needs to replaced with correct code.
Kindly have a re-look on the cell before the test code you shared.
UNQ_C4
GRADED FUNCTION: predict
If unable to find, then you can share your notebook, or the codes of UNQ_C4 via personal DM. Click on my name and then message. Do not post codes here on public thread as it is against community guidelines(just a heads up)
Regards
DP
Hi Deepti,
Thank You again for your help. I found the mistake in my code and I can move forward now. Apologies for posting codes here on public.
Thanks and Regards,
Megha
1 Like