title: Convert Functions into lambda functions
body: <p>i have to convert the following functions into lambda functions, without changing the semantics. How i have to do this?</p>
  
  <pre><code>u = 1
  
  def method1(x):
      def method2(n):
          def method3(m):
              return x + n + m
          def method4():
              global u
              u += 1
          method4()
          return method3
      def method5(y):
          return x + y
      return method2, method5
  </code></pre>
  
  <p>Edit:
  Here are my attempts:</p>
  
  <pre><code>method1 x: method2 n: method3 m: x+n+m, method 4 (): method 3, method5 y: x+y, method2 method3
  </code></pre>
  
  <p>Edit2:</p>
  
  <pre><code>method1 = lambda x:
      method2 = lambda n:
          method3 = lambda m:
           x + n + m
          method4 = lambda :
           global u
           u = u + 1
          #dont know how to integrate "method4() return method3"
      method5 = lambda y:
        x + y
      method2, method5
  </code></pre>