function in python
<p>In a function, I need to perform some logic that requires me to call a funtion inside a function. what i did with this , like :</p>

<pre><code>def dfs(problem):
   stack.push(bache)
   search(root)              
   while stack.isEmpty() != 0:


  def search(vertex):
     closed.add(vertex)
     for index in sars:
        stack.push(index)
        return stack
</code></pre>

<p>In the function, dfs, i am using search(root), is this is the correct way to do it?</p>

<p>I am getting an error:  <strong>local variable 'search' referenced before assignment</strong></p>
