title: Lambda multiple functions implementation in Python like Linux Pipeline command
body: <p>I am implementing this requirement:</p>
  <blockquote>
  <p>As part of a data processing pipeline, complete the implementation of the pipeline method:</p>
  <ul>
  <li><p>The method should accept a variable number of functions, and it
  should return a new function that accepts one parameter <em>arg</em>.</p>
  </li>
  <li><p>The returned function should call the first function in the pipeline
  with the parameter <em>arg</em>, and call the second function with the result
  of the first function.</p>
  </li>
  <li><p>The returned function should continue calling each function in the
  pipeline in order, following the same pattern, and return the value
  from the last function.</p>
  </li>
  </ul>
  <p>For example, <code>pipeline(lambda x: x * 3, lambda x: x + 1, lambda x: x / 2)</code> then calling the returned function with 3 should return 5.0.</p>
  </blockquote>
  <h1>My code</h1>
  <pre><code>def pipeline(*funcs):
      def helper(arg):
          argCount = len(funcs)
          if argCount &gt; 0:
              # Iterate over all the arguments and call each lamba's function
              res = []
              for elem in funcs:
                  if(len(res) &gt; 0):
                      helper = elem(res.pop())
                  else:
                      helper = elem(arg)
                  res.append(helper)
              helper = res.pop()
          else:   
              return helper
              
          print('before returning, helper value is: ', helper)
      return helper
      
  fun = pipeline(lambda x: x * 3, lambda x: x + 1, lambda x: x / 2)
  print('final result: ', fun(3)) #should print 5.0
  </code></pre>
  <h1>Question</h1>
  <p><code>None</code> is returned. Why?</p>
  <pre><code>before returning, helper value is:  5.0  
  final result:  None
  </code></pre>