Exemplo n.º 1
0
def start(points, ques_count, questions):
    while True:
        # For loop prints the question
        for x in num_list:
            correct_answer = 0
            # answ_count = 0
            ques_count += 1
            print_question(ques_count, questions[x][0])
            a_num_list = answers_number_list()

            # Prints the list of choices
            choice_list(x, a_num_list, questions)

            # Note which answer is the correct one
            correct_answer = a_num_list.index(1) + 1

            # Player inputs the answer number
            choice = input_answer()

            # Compare choice to correct answer, give response and apply points
            points = add_points(points, choice, correct_answer)
        break
    return points
Exemplo n.º 2
0
 def test_invalid_space(self, mock_input):
     num = input_answer()
     self.assertEqual(sys.stdout.getvalue().strip(), 'Error! Enter a valid number')
     self.assertEqual(num, 3)
Exemplo n.º 3
0
 def test_valid_number_3(self, mock_input):
     num = input_answer()
     self.assertEqual(num, 3)