title: Issue with calling a function inside a while loop
body: <p>I don't know if this is a simple question or not, but I couldn't find anything on it so I figured I would ask it.</p>
  
  <p>I try to call a function in a while loop but it keeps on returning the same result until the condition is completed. The function <code>main()</code> is imported from another file and return a list with two elements <code>[a,b]</code>.</p>
  
  <p>Those two elements are generated randomly, therefor they should change after every step. The function works perfectly fine if I call it on its own.</p>
  
  <p>Here is my code so far, I hope someone can help me:</p>
  
  <p>I thought there was something wrong with my list <code>x</code> so I tried to delete it after every step, but it doesn't change anything.</p>
  
  <pre><code>from some_module import main
  
  def loop(variable):
  
      i = 0
      while i &lt;= 5 :
  
          x = main(variable)
          a ,b = x[0], x[1]
          print a, b
          del x[:]
          i += 1
  </code></pre>
  
  <p>The code for main() is :</p>
  
  <pre><code>def main(file):
      iniciate(file)
      obtain_neighbours(initial_solution())
      get_all_costs(get_all_solutions())
      return get_best_solution()
  </code></pre>
  
  <p>And the random choice appears in the function initial_solution() :</p>
  
  <pre><code>#those list are being updated at every step
  So = []
  I_assign = []
  I_available = ['1','2','3','4',...,'n']
  
  def initial_solution():
  
      while len(I_available) != 0:
          update_I_assign()
          random_task = random.choice(I_assign)
          So.append(random_task)
          I_available.remove(random_task)
      return So
  
  def get_best_solution():
  
      if min(i for i in all_cost) &lt; calculate_cost(fill_station(So)):
           best_solution = solutions[all_cost.index(min(i for i in all_cost))]
           return [min(i for i in all_cost),best_solution]
      else:
          best_solution = fill_station(So)
          return [calculate_cost(fill_station(So)),best_solution] 
  </code></pre>
  
  <p>It's pretty hard for me to show the rest of the code here because it's quite long. Hope the update helps you understand.</p>