{moderator edit: code removed}
I keep getting this error when trying to complete the assignment. Any assistance is greatly appreciated.
{moderator edit: code removed}
Please don’t post your code on the forum. That’s not allowed by the community guidelines.
I’ll edit your message to remove the code.
The issue is stated in the error message. It’s from this line of code:
cost_sum = cost_sum + cost
The first time this line of code is executed, there is no previous value for cost_sum to add to itself. So you used cost_sum before it was assigned an initial value.
When you use this sort of modify-in-place construct, you need to set an initial value for cost_sum before you get into the for-loop,.
Thank you. That makes sense. I am still getting the error that x_train is not defined?
Be sure you run all of the cells in the notebook every time you open it.