Same logic in for loop givivng different results

I am solving the linear regression practice lab to compute cost function and the below 2 codes are giving me different answers. Could someone please explain why -

Code 1

# mentor edit: code removed

Code 2

# mentor edit: code removed        

@Zerxes24 in code 2 you have:


Whereas in code 1:



1 Like

@Zerxes24, just a reminder, please don’t post your code for the assignments on the forum.

If a mentor needs to see your code, we’ll contact you with instructions.

sure. could you please tell me how I can get in touch with mentors directly for assignment doubts ?

Generally if you post your question on the forum, describe the issue, post images of any error messages, then a mentor will reply.