title: Quiz from external text file Python
body: <p>I am trying to create a quiz where I have questions and answers from an external text file to import into Python so that the user can input a selection.</p>
  
  <p>The problem is that my code only prints <code>"Correct"</code> at the <em>end</em> of the quiz once, and doesn't say after each question answered if the user got the question correct or incorrect.</p>
  
  <p>The first column (<code>detail[0]</code>) is where the question is and the correct answer is in the fourth column (<code>detail[4])</code>)</p>
  
  <p>Thanks</p>
  
  <p>Here is what is in the text file:</p>
  
  <pre><code>What is 1+1,1,2,2
  What is 2+2,4,2,4
  </code></pre>
  
  <p>Here is the source code below:</p>
  
  <pre><code>def quiz():
      file = open("quiz.txt","r")
      right = False
  
      for line in file:
          detail = line.split(",")
          print(detail[0])
          select = input("Select 1 or 2: ")
          if select == detail[3]:
              right = True
              break
  
      if right == True:
          print("Correct")
      else:
          print("Incorrect")
  </code></pre>