def normalize_rows(x):
“”"
Implement a function that normalizes each row of the matrix x (to have unit length).

Argument:
x -- A numpy matrix of shape (n, m)
Returns:
x -- The normalized (by row) numpy matrix. You are allowed to modify x.
"""
#(≈ 2 lines of code)
# Compute x_norm as the norm 2 of x. Use np.linalg.norm(..., ord = 2, axis = ..., keepdims = True)
# x_norm =
# Divide x by its norm.
# x =
# YOUR CODE STARTS HERE
x_norm = Moderator Edit: Solution Code Removed
x = Moderator Edit: Solution Code Removed
# YOUR CODE ENDS HERE
return x

This indentation error means you have some extra spaces. It’s important to have consistent space.
Can you see the level difference (space difference) of your code for x_norm and x and the one already given to you?

Right! The point is that indentation is part of the syntax in python, unlike a lot of other programming languages. For example, the indentation controls which statements are part of the body of function or a “for” loop or an “if” statement. You can’t just mess with the indentation: you have to know what it means and handle it consistently. If this is news to you, please realize that you already need to know python before you start any of the MLS or DLS courses. You might want to consider taking an “intro to python” course before you continue here.

Also note that the first principle of debugging is “Believe the error message”. Sometimes error messages can be a bit confusing and then it takes some work to understand what they mean, but that is not the case here: that’s about as clear an error message as you can ever hope to get.