title: Python Validation with While Loops
body: <p>So, I'm basically trying to make it so it won't proceed with a function unless you type yes/no after the inputs. This function will just add your inputs into a list. Basically I want the program to make you input a bunch of different numbers, it'll then at the end of inputting them ask you if you'd like to proceed. If you press yes I'd like it to proceed with the function but in my code I made it so each input is on a new input line, not in the same one so when I append it to the list I'm using a while statement.</p>
  
  <p>If you need me to clarify more, please let me know.</p>
  
  <p>Code:</p>
  
  <pre><code>next2=input("How many would you like to add? ")
  print("")
  count = 0
  while count &lt; int(next2):
      count = count + 1
      next3=input(str(count) + ". Input: ")
      add(next3)
  print("")
  check=input("Are you sure? (Y/N) ")
  while check not in ("YyYesNnNo"):
      check=input("Are you sure? (Y/N) ")
  if check in ("YyYes"):
      home()
  </code></pre>
  
  <p>Function:</p>
  
  <pre><code>def add(next2):
      numbers.append(next2)
      sort(numbers)
  </code></pre>
  
  <p>When you run this program it should look like this:</p>
  
  <pre><code>How many numbers would you like to add? "4"
  1. Input: 4
  2. Input: 3
  3. Input: 2
  4. Input: 1
  
  Are you sure? (Y/N): Y
  
  &gt; append the inputs here
  </code></pre>
  
  <p>If they click no, it brings them to the home screen of the program which I already have setup.</p>
  
  <p>This is what it does right now:</p>
  
  <p>How many numbers would you like to add? "4"
  1. Input: "4"</p>
  
  <blockquote>
    <p>Append to list
    2. Input: "3"
    Append to list
    3. Input: "2"
    Append to list
    4. Input: "1"
    Append to list
    Are you sure? (Y/N): "Y"
    Sort list and display</p>
  </blockquote>