input: Write a function to grade a test based on given questions and their answers.
  assert grade_test([{'answer': 'A', 'correct_answer': 'A'}, {'answer': 'B', 'correct_answer': 'C'}]) == 3
  assert grade_test([{'answer': 'D', 'correct_answer': 'D'}, {'answer': 'A', 'correct_answer': 'A'}, {'answer': 'C', 'correct_answer': 'C'}]) == 9
  assert grade_test([{'answer': 'B', 'correct_answer': 'A'}, {'answer': 'C', 'correct_answer': 'C'}, {'answer': 'D', 'correct_answer': 'D'}]) == 6
output: def grade_test(questions):
      score = 0
      for question in questions:
          if question['answer'] == question['correct_answer']:
              score += 3
      return score