You can check the hint below also first you want to do a loop over number of training examples(m), second you want to compute the prediction by multiply the weight w with corsponding training examplex[…] , and add the bias term to the result, after that subtract the result with the corsponding real value y[…], and take the square of it by this equation cost =\sum_{i=0}^{m} (prediction - real\ value\ y)^2 , and after the loop, and before return divide the result with (2*m(number of training example))

yes I added the missing code only. But when test code was run on jupyter , it is giving me error and wrong result. Whereas same code when executed in spyder , I got the exact answer as given Expected Output.

@Gouri_Halde
The indentation of the loop isn’t correct(indentation = use tap space), also after the for loop,you want to divide the cost_sum by 2*m before return it