title: return value of function to another function python
body: <p>Disclaimer: I am new to programming.
  The following code doesn't work, as it seems the output of function 1 is not passed to function 2.</p>
  
  <pre><code>def img_to_color(path_file):
  
  # takes an image and calculates avg red / green / blue value
  color_avg = [red, green, blue]
  return color_avg        
  
  def extract_RGB(path_folder):
  
  j = 0
  RGB = []
  file_count = len(os.listdir(path_folder))
  files = os.listdir(path_folder)
  while j &lt; file_count:
      img_to_color(path_folder + "/" + files[j])
      RGB.append(color_avg)
      j = j+1
  X_training.append(trainingDataFolder(pfad, RGB))
  </code></pre>
  
  <p>The function img_to_color works, however RGB stays [] even though I call the function.</p>