C1_W3 Problems with Exercise 2

I have no clue how to approach Exercise 2 without encountering errors.

Hi @richkg22,

Python is complaining that cost does not yet exist when you’re trying to divide it by m. It seems like you forgot to initialize this variable and update it. If you want help debugging this function feel free to DM me your code.

Your code appears to be missing a line that would give ‘cost’ an initial value of 0.

Replied in DM. Please let me know if you need further assistance.