Course1 Week3 Exercise 8 local variable 'parameters' referenced before assignment

Hi I get an error “UnboundLocalError: local variable ‘parameters’ referenced before assignment”.

I know I defined global paremeters outside the loop. Do I need to do anything inside the loop to get rid of this error?

Thanks!

Hello @chengchenggan,

According to the assignment,

    # Initialize parameters
    #(≈ 1 line of code)
    # parameters = ...
    ### BEGIN SOLUTION

    ### END SOLUTION
    
    # Loop (gradient descent)

    for i in range(0, num_iterations):
         ...

The parameters variable should be defined inside the function right before the for-loop. Did you do that there, and was the variable name spelled correctly?

Cheers,
Raymond

Thanks Raymond. I thought I checked spelling, but end up still a spelling issue… Thanks a lot