Hi everyone,

This is a question I had when I was doing Jupyter Notebook practice.

First, I defined the function get_y() and tested it:

```
def get_y(m, b, x):
return m*x + b
print(get_y(1, 0, 7) == 7)
print(get_y(5, 10, 3) == 25)
```

Then I wrote another function:

```
def calculate_error(m, b, point):
x_point = point[0]
y_point = point[1]
get_y = get_y(m, b, x_point)
return abs(get_y - y_point)
```

When I run the testing codes:

```
#this is a line that looks like y = x, so (3, 3) should lie on it. thus, error should be 0:
print(calculate_error(1, 0, (3, 3)))
#the point (3, 4) should be 1 unit away from the line y = x:
print(calculate_error(1, 0, (3, 4)))
#the point (3, 3) should be 1 unit away from the line y = x - 1:
print(calculate_error(1, -1, (3, 3)))
#the point (3, 3) should be 5 units away from the line y = -x + 1:
print(calculate_error(-1, 1, (3, 3)))
```

The error shows:

**UnboundLocalError: local variable ‘get_y’ referenced before assignment**

I tried to fix it by replacing “get_y” variable to “y”, and it worked. I googled this error but I am still a little confused:

I didn’t find my “get_y” variable referenced before. Is it because there is a conflict between variable name and the function name?

Thanks