kyu_6.multiples_of_3_or_5 package

Submodules

kyu_6.multiples_of_3_or_5.solution module

Solution for -> Multiples of 3 or 5.

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

kyu_6.multiples_of_3_or_5.solution.solution(number: int) int[source]

Solution for ‘ultiples of 3 or 5’ problem.

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Finish the solution so that it returns the sum of all the multiples of 3 or 5 below the number passed in. :param number: :return:

kyu_6.multiples_of_3_or_5.test_solution module

Test for -> Multiples of 3 or 5.

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

class kyu_6.multiples_of_3_or_5.test_solution.SolutionTestCase(methodName='runTest')[source]

Bases: TestCase

Testing solution function.

_classSetupFailed = False
_class_cleanups = []
test_solution = None
test_solution_0(**kw)

Testing solution function [with number=4, expected=3, msg=’Should return 3 for n=4’].

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Finish the solution so that it returns the sum of all the multiples of 3 or 5 below the number passed in.

Note: If the number is a multiple of both 3 and 5, only count it once. :return:

test_solution_1(**kw)

Testing solution function [with number=200, expected=9168, msg=’Should return 9168 for n=200’].

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Finish the solution so that it returns the sum of all the multiples of 3 or 5 below the number passed in.

Note: If the number is a multiple of both 3 and 5, only count it once. :return:

test_solution_2(**kw)

Testing solution function [with number=-1, expected=0, msg=’Should return 0 for n=-1’].

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Finish the solution so that it returns the sum of all the multiples of 3 or 5 below the number passed in.

Note: If the number is a multiple of both 3 and 5, only count it once. :return:

test_solution_3(**kw)

Testing solution function [with number=1291, expected=388935, msg=’Random test’].

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Finish the solution so that it returns the sum of all the multiples of 3 or 5 below the number passed in.

Note: If the number is a multiple of both 3 and 5, only count it once. :return:

Module contents

Multiples of 3 or 5.