title: Understanding Nested functions in python
body: <p>I am new in stackflow. I will so thankful if someone can help me.</p>
  
  <p>I have to resolve this:</p>
  
  <p>Define a nested function called nested_sum, where in the first part of the function you accept an argument called x, and in the second part (the function inside) you take another argument called y. In the function inside you have to calculate the sum of x and y. </p>
  
  <p>To test your function create a variable called <code>res_1</code> where you pass the <code>x</code> argument to <code>nested_sum</code>, and then create a variable called <code>res_2</code> where you pass the <code>y</code> argument of the <code>res_1</code> variable to get the final solution. </p>
  
  <p>Have <code>x</code> equal 2 for <code>res_1</code> and y equal 10 for <code>res_2</code>.</p>
  
  <p>After looking on the internet I found a similar code, but I don't really understand how it works!</p>
  
  <pre><code>def nested_sum(x):
      def in_sum(y):
          return x+y
      return in_sum
  
  res_1 = nested_sum(2)
  res_2 = res_1(10)
  </code></pre>
  
  <p>Thank you</p>