kyu_8.check_the_exam package

Submodules

kyu_8.check_the_exam.check_exam module

Solution for -> Check the exam.

Created by Egor Kostan. GitHub: https://github.com/ikostan

kyu_8.check_the_exam.check_exam.char_processor(char: tuple, results: list) None[source]

Process chars based on specified rule.

Parameters:
  • char – str

  • results – list

Returns:

None

kyu_8.check_the_exam.check_exam.check_exam(arr1: list, arr2: list) int[source]

Check exam.

The first input array contains the correct answers to an exam, like [“a”, “a”, “b”, “d”]. The second one is “answers” array and contains student’s answers.

The two arrays are not empty and are the same length. Return the score for this array of answers, giving +4 for each correct answer, -1 for each incorrect answer, and +0 for each blank answer(empty string).

If the score < 0, return 0.

Parameters:
  • arr1 – list

  • arr2 – list

Returns:

int

kyu_8.check_the_exam.test_check_exam module

Test for -> Check the exam.

Created by Egor Kostan. GitHub: https://github.com/ikostan

class kyu_8.check_the_exam.test_check_exam.CheckExamTestCase(methodName='runTest')[source]

Bases: TestCase

Testing check_exam function.

_classSetupFailed = False
_class_cleanups = []
test_check_exam = None
test_check_exam_0(**kw)

Testing check_exam function with various test data [with arr1=[‘a’, ‘a’, ‘b’, ‘b’], arr2=[‘a’, ‘c’, ‘b’, ‘d’], expected=6].

The function should return the score for this array of answers, giving +4 for each correct answer, -1 for each incorrect answer, and +0 for each blank answer(empty string). :return:

test_check_exam_1(**kw)

Testing check_exam function with various test data [with arr1=[‘a’, ‘a’, ‘c’, ‘b’], arr2=[‘a’, ‘a’, ‘b’, ‘’], expected=7].

The function should return the score for this array of answers, giving +4 for each correct answer, -1 for each incorrect answer, and +0 for each blank answer(empty string). :return:

test_check_exam_2(**kw)

Testing check_exam function with various test data [with arr1=[‘a’, ‘a’, ‘b’, ‘c’], arr2=[‘a’, ‘a’, ‘b’, ‘c’], expected=16].

The function should return the score for this array of answers, giving +4 for each correct answer, -1 for each incorrect answer, and +0 for each blank answer(empty string). :return:

test_check_exam_3(**kw)

Testing check_exam function with various test data [with arr1=[‘b’, ‘c’, ‘b’, ‘a’], arr2=[‘’, ‘a’, ‘a’, ‘c’], expected=0].

The function should return the score for this array of answers, giving +4 for each correct answer, -1 for each incorrect answer, and +0 for each blank answer(empty string). :return:

Module contents

Check the exam.