Week-2-practice-lab-linear-regression_error

Hii,
all the expected outputs are coming even though I am getting this error.

Code Cell UNQ_C1: Unexpected error (IndexError(‘index 3 is out of bounds for axis 0 with size 3’)) occurred during function check. We expected function compute_cost to return cost for perfect prediction must be 0. Please check that this function is defined properly.
Code Cell UNQ_C2: Unexpected error (IndexError(‘index 3 is out of bounds for axis 0 with size 3’)) occurred during function check. We expected function compute_gradient to return compute_gradient failed expected [2., [0]]. Please check that this function is defined properly.
If you see many functions being marked as incorrect, try to trace back your steps & identify if there is an incorrect function that is being used in other steps.
This dependency may be the cause of the errors.
help me.
thankyou.

Hi @Laksman_puvanayokesw ,

The indexError means your code is indexing an array outside the length of the array. For example, if the array has the length of 4, ie, 4 elements, and your index variable n starts from 0, then the last element of the array is when n = 3. If n =4, then, indexError occurs.

So you need to check your code and to find out how your index works. Please see the hints provided for a step by step guide on how to code these two functions.