# [Solved] All I get is “Name: name ‘x’ is not defined”

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error All I get is “Name: name ‘x’ is not defined” in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

## How All I get is “Name: name ‘x’ is not defined” Error Occurs?

Today I get the following error All I get is “Name: name ‘x’ is not defined” in python.

## How To Solve All I get is “Name: name ‘x’ is not defined” Error ?

1. How To Solve All I get is “Name: name 'x' is not defined” Error ?

To Solve All I get is “Name: name 'x' is not defined” Error x is not defined, and you cannot pass f(x) in the parameter. Try doing something like this:

2. All I get is “Name: name 'x' is not defined”

To Solve All I get is “Name: name 'x' is not defined” Error x is not defined, and you cannot pass f(x) in the parameter. Try doing something like this:

## Solution 1

When you tell it to :

```print derivative(f(x),4,6)
```

you haven’t defined the x you are passing as a parameter in f(x).

You can do that like so, for example with x = 1 :

```def f(x):
return x**2 + x - 5

def derivative(f,x,h):
return 1/(2*h) * (f(x+h) - f(x-h))

x=1

print derivative(f(x),4,6)```

## Solution 2

x is not defined, and you cannot pass f(x) in the parameter. Try doing something like this:

```def f(x):
return x**2 + x - 5

def derivative(f,x,h):
return 1/(2*h) * (f(x+h) - f(x-h))

x=12345

print derivative(f,x,6)```

## Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.