Hello,
I understood from the first assignment to write a code while following the function in the Hint below (I couldn’t find another one/am lost). Does anyone understand the request/see where my code is wrong?
My code output has one error too although the assignment explicitly says not to change anything from the original code …
Output:
Type of x_train: <class ‘numpy.ndarray’>
First five elements of x_train are:
[6.1101 5.5277 8.5186 7.0032 5.8598]
Type of y_train: <class ‘numpy.ndarray’>
First five elements of y_train are:
[17.592 9.1302 13.662 11.854 6.8233]
The shape of x_train is: (97,)
The shape of y_train is: (97,)
Number of training examples (m): 97
File “”, line 52
return total_cost
^
SyntaxError: ‘return’ outside function
Code image removed.
The assignment in case you need it :
Perhaps you have removed some blank space at the return line, because this error means the indentation at the return line is not right!
1 Like
@Mutasem
check your first grade function codes where you probably moved the last code line which mentions return function( you probably edited or moved it from its original position?
A successful test results comes when you only replace the None placed between ###START AND END CODE HERE### without editing/deleting or adding anything outside of these code markers.
Also kindly choose the categories correctly, you have choosen mls resource with header assignment 1, so it is unclear if it is 1st course or 2nd course.
Okay I just saw your posted pic, you have completed edited the grade function codes with extra code lines plus seems like you copy pasted which caused syntax space error for the return function. Get a fresh copy and re-do your assignment by following the instructions I mentioned before.
Regards
DP
1 Like