kyu_6.easy_diagonal package

Submodules

kyu_6.easy_diagonal.diagonal module

Solution for -> Easy Diagonal.

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

kyu_6.easy_diagonal.diagonal.diagonal(n: int, p: int) int[source]

Diagonal function.

We want to calculate the sum of the binomial coefficients on a given diagonal. The sum on diagonal 0 is 8 (we’ll write it S(7, 0), 7 is the number of the line where we start, 0 is the number of the diagonal). In the same way S(7, 1) is 28, S(7, 2) is 56.

Parameters:
  • n – n is the line where we start and

  • p – p is the number of the diagonal

Returns:

the sum of the binomial coefficients on a given diagonal

kyu_6.easy_diagonal.test_diagonal module

Test for -> Easy Diagonal.

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

class kyu_6.easy_diagonal.test_diagonal.EasyDiagonalTestCase(methodName='runTest')[source]

Bases: TestCase

Testing easy_diagonal function.

_classSetupFailed = False
_class_cleanups = []
test_easy_diagonal = None
test_easy_diagonal_0(**kw)

Testing easy_diagonal function [with n=7, p=0, expected=8].

Parameters:

self

Returns:

test_easy_diagonal_1(**kw)

Testing easy_diagonal function [with n=7, p=1, expected=28].

Parameters:

self

Returns:

test_easy_diagonal_2(**kw)

Testing easy_diagonal function [with n=7, p=2, expected=56].

Parameters:

self

Returns:

test_easy_diagonal_3(**kw)

Testing easy_diagonal function [with n=20, p=3, expected=5985].

Parameters:

self

Returns:

test_easy_diagonal_4(**kw)

Testing easy_diagonal function [with n=100, p=0, expected=101].

Parameters:

self

Returns:

test_easy_diagonal_5(**kw)

Testing easy_diagonal function [with n=20, p=4, expected=20349].

Parameters:

self

Returns:

test_easy_diagonal_6(**kw)

Testing easy_diagonal function [with n=20, p=15, expected=20349].

Parameters:

self

Returns:

test_easy_diagonal_7(**kw)

Testing easy_diagonal function [with n=1291, p=5, expected=6385476296235036].

Parameters:

self

Returns:

test_easy_diagonal_8(**kw)

Testing easy_diagonal function [with n=129100, p=5, expected=6429758786797926366807779220].

Parameters:

self

Returns:

Module contents

Easy Diagonal.