title: Python Preventing Duplicates in User-Generated Integer List, While-loop and Try-Except
body: <p> I want the user to input 10 unique integers in the set [1, 100]. This is my code so far:</p>
  
  <pre class="lang-python prettyprint-override"><code>user_list = []
  print "\nChoose any 10 discrete integers in the set [1, 100]. Do not choose duplicates."
  
  i = 1
  
  while i &lt; 11:
      try:
          number_choice = int(raw_input("\nNumber %d?\n&gt; " % i))
  
          if (0 &lt;= number_choice &lt;= 100) and isinstance(number_choice, int):
              i += 1
              user_list.append(number_choice)
              print "Your list so far: %r" % user_list
          elif (number_choice &lt; 0) or (number_choice &gt; 100):
              print "'I said to keep it in the set [1, 100].'"
              pass
          else:
              pass
  
      except ValueError:
          print "'That isn't a discrete integer, is it?'"
  
  print sorted(user_list)
  </code></pre>
  
  <p>To prevent duplicates, I wanted to change the first <code>if</code> to read:</p>
  
  <pre class="lang-python prettyprint-override"><code>if (0 &lt;= number_choice &lt;= 100) and (isinstance(number_choice, int)) and (number_choice not in user_list):
  </code></pre>
  
  <p>This would work, except it would just repeat the <code>"Number %d?" %  i</code> prompt again if the user input a duplicate. How can I modify this code so it first displays a prompt <code>'I said no duplicates.'</code> and then resumes the loop?</p>