C2_W4_Decision_Tree_with_Markdown Exercise 3


I am running into an issue from Exercise 3 on. I keep getting this error message: UnboundLocalError: local variable ‘p1’ referenced before assignment

Exercise 1 and 2 both came back with all tests passing but now I get this error for any exercise afterwards. I checked the coding and it appears correct. I have restarted the kernel and started a new notebook twice and I still get the same error. Can someone please advise?


This means your code is trying to use the p1 variable, but you have not yet assigned it a value.

Usually this happens if your code does not correctly handle the case where length of y is zero. That’s one of the unit tests.

Okay great, thank you for the feedback. I found the issue in my coding and everything seems to be working and I was able to finish the assignment. Thanks again!