title: Save results of a python function into a list
body: <p>Hi folks good afternoon - I am running into an issue, and it is a simple issue, however I am having some issues in base python (3.7) 
  Problem: So I am trying to create this loop, that just finds divisors for an integer and then I would like to save the result as an index able object (e.g a list) but when I run the following code my object labeled "test" is an empty list</p>
  
  <pre><code># function divisors
  def divisors(n):
  #empty list start
      test = []
      i = 1
      while i &lt;= n:
          if (n % i == 0):
          print(i),
          #append test
          test.append(i), # I know i is not the correct object here, it's just a place holder for this example
      i = i + 1
  </code></pre>
  
  <p>could you please point to me what mistake I am making here? I can solve this problem using numpy, but I would like to understand python and how it works better. Seems like I have to add a variable that stores the results for loop and then append test with that variable? </p>
  
  <p>thank you much</p>