Hi Fatma! In the first place, remember that you are only supposed to edit the code between ### START CODE HERE ###
and ### END CODE HERE ###
.
Second, the function compute_cost
returns a float: total_cost
, which is the cost of using w, and b as the parameters for linear regression to fit the data points in x and y.
According to the TypeError: unsupported format string passed to numpy.ndarray I believe your output is a NumPy ndarray.
Cheers,
Yes, it is. I just search for how can I solve it since I don’t know any experience with python before
Did you get your answer right?
If not then use
print(f’Cost at initial w: {cost:.3f}‘)
instead of: print(f’(Cost at initial w: {cost:.3f})') .
Getting familiar with Python is helpful for this course, Checkout this Programming for Everybody (Getting Started with Python) course.
What is the difference between both?
Yeah, I just begun it this week
No difference except, () will get printed in first case.
I realised that like Enzo mentioned you have error with what you are returning from the function you implemented in above cell. compute_cost function should return a float value while in your case it is returning an array.
If you are not finding how you changed the data type of total_cost, reload a new notebook and only change the code between ### START CODE HERE ###
and ### END CODE HERE ###
.
Thanks for explaining it. I am going to try it and see what will go on