title: How to run python loop until correct input string is entered
body: <p>I have to write a code that will execute the below while loop only if the user enters the term &quot;Cyril&quot;.</p>
  <p>I am a real newbie, and I was only able to come up with the below solution which would force the user to restart the program until they enter the correct input, but I would like it to keep asking the user for input until they input the correct answer. Could anybody perhaps assist? I know I would probably kick myself once I realise there's a simple solution.</p>
  <pre><code>number_list = []
  attempts = 0
  name = False
  number = 0
  
  name_question = input(&quot;You are the President of RSA, what is your name?: &quot;)
  if name_question == &quot;Cyril&quot;:
      name = True
  else:
      print(&quot;\nThat is incorrect, please restart the program and try again.\n&quot;)  
  
  if name:
      number = int(input(&quot;Correct! Please enter any number between -1 and 10: &quot;))
      while number &gt; -1:
          number_list.append(number)
          number = int(input(&quot;\nThank you. Please enter another number between -1 and 10: &quot;))
      if number &gt; 10:
          print(&quot;\nYou have entered a number outside of the range, please try again.\n&quot;)
          number = int(input(&quot;Please enter a number between -1 and 10: &quot;))
      elif number &lt; -1:
          print(&quot;\nYou have entered a number outside of the range, please try again. \n&quot;)
          number = int(input(&quot;Please enter a number between -1 and 10: &quot;))
      elif number == -1:
          average_number = sum(number_list) / len(number_list)
          print(&quot;\nThe average number you have entered is:&quot;, round(average_number, 0))
  </code></pre>