title: Restart Function After List Is X Length
body: <p>Please help me out.</p>
  
  <p>I have a RPi connected up to a sound sensor. Every time the detector is activated, a string gets inserted into a list.</p>
  
  <p>What I want to do, is restart the whole process once the list is 7 units long. See my code below.</p>
  
  <pre><code>import RPi.GPIO as GPIO
  
  GPIO.setmode(GPIO.BOARD)
  pin = 7 #Defining pin 7 as Input pin
  GPIO.setup(pin, GPIO.IN)
  
  list = ["Start"]
  
  while l:
      if GPIO.input(pin) == GPIO.LOW: #This is the input
          if len(list) &lt;= 6:
              list.insert(0, "Entry") #Insert into list at first position
              print ("Not Done")
              print (len(list))
  
          elif len(list) &gt; 6:
              print ("Done")
  
  #This is where I want it to go back to the list being 1 unit long.
  </code></pre>
  
  <p>So, as you can see, when the list is 7 units long, the function is done. So now, I want it to restart and go back to the list being 1 unit long again. How do I do that? Been battling for days.</p>
  
  <p>Thanks!</p>