title: How to end loop with user input but not count it in the overall average of the numbers
body: <p>I am currently studying C++ but my friend sometimes sends me his past papers from his python studies so that I can try them out. I am currently having a small problem with one of the final questions. I must add and find the average of the numbers entered and end the loop when the user enters a certain number eg:-200.</p>
  
  <p>I managed to find the average but it includes the -200 in the average and how many numbers where entered. I tried breaking the loop before it adds the -200 to the list and I tried adding 200 after its been added to the loop but it they both did not work.<br>
  This is what I have so far:  </p>
  
  <pre><code>avg = []
  count = 0
  while True:
      x = float(input('Enter a number(interger or float) :'))
      avg.append(x)
      count +=1
  
      if x == -999:
  
          list = avg 
          sum(list)
          len(list)
          avg = float(sum(list))/len(list)
          print ('The average of', count, 'is ' "%0.2f" % avg)
          break
  </code></pre>