title: whats wrong with this while loop in Python?
body: <p>Ok so I have spent hours trying to resolve this and I feel its some simple error but I cannot find a way to resolve this.
  the section I am having issues with is the second half of the code. There seems to be an infinite loop somewhere among the 2 nested while loops. If anyone is able to help, this would be great, thanks in advance.</p>
  
  <pre><code>import sympy as sym
  import random
  
  A, B, C, D, E, F, G, H, I, J = sym.symbols('A, B, C, D, E, F, G, H, I, J')
  picks_a_person = [A, B, C, D, E, F, G, H, I, J] #List of people picking a name from a hat
  person_gets_picked = [A, B, C, D, E, F, G, H, I, J] # List of names drawn from a hat
  def re_draws(p):
      n = 0
      count = 0
      while n &lt; 1000: #Repeats the test 1000 times for an accurate percentage
          n += 1
          random.shuffle(person_gets_picked) #Chooses a random order of the list of names drawn
          for i in range(p):
              if person_gets_picked[i] == picks_a_person[i]: #Checks for all 'p' elements of the lists are different
                  count = count + 1
      print("count = " + str(count)) #Returns the number of times a re-draw was not required
  
  import numpy as np
  from collections import Counter
  
  total = []
  while len(total) &lt; 1000:
      order = []
      picks_a_person = [A, B, C, D, E, F, G, H, I, J]
      person_gets_picked = [A, B, C, D, E, F, G, H, I, J]
      while len(order) &lt; 10:
          a = person_gets_picked[random.randint(0, (len(person_gets_picked)-1))]
          if a != picks_a_person[0]:
              order.append(a)
              person_gets_picked.remove(a)
              del picks_a_person[0]
      total.append(order)
  Counter(np.array(total)[:,1])
  </code></pre>