title: What does AttributeError: 'tuple' object has no attribute 'append' and how do I fix my code?
body: <p>I'm stuck on an assignment from my professor. It's asking me to do the following: </p>
  
  <p>Write a program in Python that will grade user's answers to a driver's license test exam that is consist of ten multiple choice questions.</p>
  
  <p>The correct answers for question 1 to question can be stored in a list called correct_answers with these initial values:</p>
  
  <p>correct_answers=['B','D','C','B','C','D','A','B','D','A']</p>
  
  <p>Your program should prompt user to enter his/her answers for the 10 questions in a single line separated by a blank. Once the user press the Enter key, build a list of answers and Lab #5 explains how to do this.</p>
  
  <p>You can, if you want to, store your answers from a list instead of reading them from the keyboard. This will save a lot of time as you don't need to enter the answers when you run your program. You should change your answers though just for testing purposes.</p>
  
  <p>Once you have your list of answers, compare each value to the list correct_answers and keep a count of how many were correct.</p>
  
  <p>Lastly, display the number of correct answers out of 10 and also display the %. So if 5 answers were correct, you should display 5 correct answers and that is 50%</p>
  
  <p>Also note that you must use functions() to solve this program.</p>
  
  <p>Here's my code: </p>
  
  <pre><code>def read_student():
      contents = ()
      for x in range (0,10):
          data = input('Enter your answers for the 10 questions in a 
  single line separated by a blank')
          contents.append(data)
      return contents 
  
  def pass_fail(correct_answers, student_answers):
      num_correct = 0
      for i in range(0, len(correct_answers)):
          if correct_answers[i] == student_answers[i]:
              num_correct = num_correct + 1
  
      print("You got %d answers correct" % num_correct)
      percent_correct = (num_correct / 10 ) * 100
      print("The percentage of correct answers is %d" % 
  percent_correct)
  
  
  correct_answers = ['B', 'D', 'C', 'B', 'C', 'D', 'A', 'B', 'D', 'A']
  student_answers = read_student()
  pass_fail(correct_answers, student_answers)
  </code></pre>
  
  <p>It keeps saying that line 5 (contents.append(data)) has a AttributeError: 'tuple' object has no attribute 'append'...if just not sure what it means or how to fix it. Any help/resources would be greatly appreciated. Thanks :)</p>